You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/19 22:00:38 UTC
[01/28] geode git commit: GEODE-2662: Gfsh displays field value on
wrong line when receiving objects with missing fields [Forced Update!]
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2632-16 76e882a54 -> 060faa5e3 (forced update)
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
index 8620cff..e2164a3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
@@ -14,23 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-import org.apache.shiro.subject.Subject;
-import org.json.JSONArray;
-
-import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.Region;
@@ -80,6 +64,19 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.cli.util.JsonUtil;
import org.apache.geode.pdx.PdxInstance;
+import org.apache.logging.log4j.Logger;
+import org.apache.shiro.subject.Subject;
+import org.json.JSONArray;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* @since GemFire 7.0
@@ -138,29 +135,28 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
System.getProperty("memberName"));
}
DataCommandResult result = null;
- if (request.isGet())
+ if (request.isGet()) {
result = get(request);
- else if (request.isLocateEntry())
+ } else if (request.isLocateEntry()) {
result = locateEntry(request);
- else if (request.isPut())
+ } else if (request.isPut()) {
result = put(request);
- else if (request.isRemove())
+ } else if (request.isRemove()) {
result = remove(request);
- else if (request.isSelect())
+ } else if (request.isSelect()) {
result = select(request);
+ }
if (logger.isDebugEnabled()) {
logger.debug("Result is {}", result);
}
functionContext.getResultSender().lastResult(result);
- } catch (CacheClosedException e) {
- e.printStackTrace();
- functionContext.getResultSender().sendException(e);
} catch (Exception e) {
- e.printStackTrace();
+ logger.info("Exception occurred:", e);
functionContext.getResultSender().sendException(e);
}
}
+
private InternalCache getCache() {
return (InternalCache) CacheFactory.getAnyInstance();
}
@@ -223,132 +219,131 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings("rawtypes")
private DataCommandResult select(Object principal, String queryString) {
+
InternalCache cache = getCache();
AtomicInteger nestedObjectCount = new AtomicInteger(0);
- if (queryString != null && !queryString.isEmpty()) {
- QueryService qs = cache.getQueryService();
-
- // TODO : Find out if is this optimised use. Can you have something equivalent of parsed
- // queries with names
- // where name can be retrieved to avoid parsing every-time
- Query query = qs.newQuery(queryString);
- DefaultQuery tracedQuery = (DefaultQuery) query;
- WrappedIndexTrackingQueryObserver queryObserver = null;
- String queryVerboseMsg = null;
- long startTime = -1;
+ if (StringUtils.isEmpty(queryString)) {
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ CliStrings.QUERY__MSG__QUERY_EMPTY, false);
+ }
+
+ QueryService qs = cache.getQueryService();
+
+ // TODO : Find out if is this optimised use. Can you have something equivalent of parsed
+ // queries with names where name can be retrieved to avoid parsing every-time
+ Query query = qs.newQuery(queryString);
+ DefaultQuery tracedQuery = (DefaultQuery) query;
+ WrappedIndexTrackingQueryObserver queryObserver = null;
+ String queryVerboseMsg = null;
+ long startTime = -1;
+ if (tracedQuery.isTraced()) {
+ startTime = NanoTimer.getTime();
+ queryObserver = new WrappedIndexTrackingQueryObserver();
+ QueryObserverHolder.setInstance(queryObserver);
+ }
+ List<SelectResultRow> list = new ArrayList<>();
+
+ try {
+ Object results = query.execute();
if (tracedQuery.isTraced()) {
- startTime = NanoTimer.getTime();
- queryObserver = new WrappedIndexTrackingQueryObserver();
- QueryObserverHolder.setInstance(queryObserver);
+ queryVerboseMsg = getLogMessage(queryObserver, startTime, queryString);
+ queryObserver.reset2();
}
- List<SelectResultRow> list = new ArrayList<SelectResultRow>();
+ if (results instanceof SelectResults) {
+ select_SelectResults((SelectResults) results, principal, list, nestedObjectCount);
+ } else {
+ select_NonSelectResults(results, list);
+ }
+ return DataCommandResult.createSelectResult(queryString, list, queryVerboseMsg, null, null,
+ true);
+
+ } catch (FunctionDomainException | GfJsonException | QueryInvocationTargetException
+ | NameResolutionException | TypeMismatchException e) {
+ logger.warn(e.getMessage(), e);
+ return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
+ e.getMessage(), false);
+ } finally {
+ if (queryObserver != null) {
+ QueryObserverHolder.reset();
+ }
+ }
+ }
+ private void select_NonSelectResults(Object results, List<SelectResultRow> list) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("BeanResults : Bean Results class is {}", results.getClass());
+ }
+ String str = toJson(results);
+ GfJsonObject jsonBean;
+ try {
+ jsonBean = new GfJsonObject(str);
+ } catch (GfJsonException e) {
+ logger.info("Exception occurred:", e);
+ jsonBean = new GfJsonObject();
try {
- Object results = query.execute();
- if (tracedQuery.isTraced()) {
- queryVerboseMsg = getLogMessage(queryObserver, startTime, queryString);
- queryObserver.reset2();
+ jsonBean.put("msg", e.getMessage());
+ } catch (GfJsonException e1) {
+ logger.warn("Ignored GfJsonException:", e1);
+ }
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("BeanResults : Adding bean json string : {}", jsonBean);
+ }
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
+ }
+
+ private void select_SelectResults(SelectResults selectResults, Object principal,
+ List<SelectResultRow> list, AtomicInteger nestedObjectCount) throws GfJsonException {
+ for (Object object : selectResults) {
+ // Post processing
+ object = securityService.postProcess(principal, null, null, object, false);
+
+ if (object instanceof Struct) {
+ StructImpl impl = (StructImpl) object;
+ GfJsonObject jsonStruct = getJSONForStruct(impl, nestedObjectCount);
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding select json string : {}", jsonStruct);
}
- if (results instanceof SelectResults) {
- SelectResults selectResults = (SelectResults) results;
- for (Iterator iter = selectResults.iterator(); iter.hasNext();) {
- Object object = iter.next();
- // Post processing
- object = this.securityService.postProcess(principal, null, null, object, false);
-
- if (object instanceof Struct) {
- StructImpl impl = (StructImpl) object;
- GfJsonObject jsonStruct = getJSONForStruct(impl, nestedObjectCount);
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding select json string : {}", jsonStruct);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_STRUCT_RESULT,
- jsonStruct.toString()));
- } else {
- if (JsonUtil.isPrimitiveOrWrapper(object.getClass())) {
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding select primitive : {}", object);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_PRIMITIVE, object));
- } else {
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Bean Results class is {}", object.getClass());
- String str = toJson(object);
- GfJsonObject jsonBean;
- try {
- jsonBean = new GfJsonObject(str);
- } catch (GfJsonException e) {
- logger.fatal(e.getMessage(), e);
- jsonBean = new GfJsonObject();
- try {
- jsonBean.put("msg", e.getMessage());
- } catch (GfJsonException e1) {
- }
- }
- if (logger.isDebugEnabled())
- logger.debug("SelectResults : Adding bean json string : {}", jsonBean);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
- }
- }
- }
- } else {
- if (logger.isDebugEnabled())
- logger.debug("BeanResults : Bean Results class is {}", results.getClass());
- String str = toJson(results);
- GfJsonObject jsonBean;
+ list.add(
+ new SelectResultRow(DataCommandResult.ROW_TYPE_STRUCT_RESULT, jsonStruct.toString()));
+ } else if (JsonUtil.isPrimitiveOrWrapper(object.getClass())) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding select primitive : {}", object);
+ }
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_PRIMITIVE, object));
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Bean Results class is {}", object.getClass());
+ }
+ String str = toJson(object);
+ GfJsonObject jsonBean;
+ try {
+ jsonBean = new GfJsonObject(str);
+ } catch (GfJsonException e) {
+ logger.error(e.getMessage(), e);
+ jsonBean = new GfJsonObject();
try {
- jsonBean = new GfJsonObject(str);
- } catch (GfJsonException e) {
- e.printStackTrace();
- jsonBean = new GfJsonObject();
- try {
- jsonBean.put("msg", e.getMessage());
- } catch (GfJsonException e1) {
- }
+ jsonBean.put("msg", e.getMessage());
+ } catch (GfJsonException e1) {
+ logger.warn("Ignored GfJsonException:", e1);
}
- if (logger.isDebugEnabled())
- logger.debug("BeanResults : Adding bean json string : {}", jsonBean);
- list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
}
- return DataCommandResult.createSelectResult(queryString, list, queryVerboseMsg, null, null,
- true);
-
- } catch (FunctionDomainException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (TypeMismatchException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (NameResolutionException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (QueryInvocationTargetException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } catch (GfJsonException e) {
- logger.warn(e.getMessage(), e);
- return DataCommandResult.createSelectResult(queryString, null, queryVerboseMsg, e,
- e.getMessage(), false);
- } finally {
- if (queryObserver != null) {
- QueryObserverHolder.reset();
+ if (logger.isDebugEnabled()) {
+ logger.debug("SelectResults : Adding bean json string : {}", jsonBean);
}
+ list.add(new SelectResultRow(DataCommandResult.ROW_TYPE_BEAN, jsonBean.toString()));
}
- } else {
- return DataCommandResult.createSelectInfoResult(null, null, -1, null,
- CliStrings.QUERY__MSG__QUERY_EMPTY, false);
}
}
private String toJson(Object object) {
if (object instanceof Undefined) {
return "{\"Value\":\"UNDEFINED\"}";
- } else if (object instanceof PdxInstance)
+ } else if (object instanceof PdxInstance) {
return pdxToJson((PdxInstance) object);
- else
+ } else {
return JsonUtil.objectToJsonNestedChkCDep(object, NESTED_JSON_LENGTH);
+ }
}
private GfJsonObject getJSONForStruct(StructImpl impl, AtomicInteger ai) throws GfJsonException {
@@ -376,14 +371,13 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createRemoveResult(key, null, null,
CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false);
}
- boolean allKeysFlag = (removeAllKeys == null || removeAllKeys.isEmpty());
- if (allKeysFlag && (key == null)) {
- return DataCommandResult.createRemoveResult(key, null, null,
+ if (StringUtils.isEmpty(removeAllKeys) && (key == null)) {
+ return DataCommandResult.createRemoveResult(null, null, null,
CliStrings.REMOVE__MSG__KEY_EMPTY, false);
}
@@ -393,7 +387,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionName), false);
} else {
if (removeAllKeys == null) {
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -406,14 +400,16 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
if (region.containsKey(keyObject)) {
Object value = region.remove(keyObject);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Removed key {} successfully", key);
+ }
// return DataCommandResult.createRemoveResult(key, value, null, null);
Object array[] = getJSONForNonPrimitiveObject(value);
DataCommandResult result =
DataCommandResult.createRemoveResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
} else {
return DataCommandResult.createRemoveInfoResult(key, null, null,
@@ -423,8 +419,9 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
DataPolicy policy = region.getAttributes().getDataPolicy();
if (!policy.withPartitioning()) {
region.clear();
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Cleared all keys in the region - {}", regionName);
+ }
return DataCommandResult.createRemoveInfoResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__CLEARED_ALL_CLEARS, regionName), true);
} else {
@@ -441,12 +438,12 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__KEY_EMPTY,
false);
}
@@ -454,12 +451,13 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
Region region = cache.getRegion(regionName);
if (region == null) {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionName);
+ }
return DataCommandResult.createGetResult(key, null, null,
CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND, regionName), false);
} else {
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -480,24 +478,27 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
// run it through post processor. region.get will return the deserialized object already, so
// we don't need to
// deserialize it anymore to pass it to the postProcessor
- value = this.securityService.postProcess(principal, regionName, keyObject, value, false);
+ value = securityService.postProcess(principal, regionName, keyObject, value, false);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Get for key {} value {}", key, value);
+ }
// return DataCommandResult.createGetResult(key, value, null, null);
Object array[] = getJSONForNonPrimitiveObject(value);
if (value != null) {
DataCommandResult result =
DataCommandResult.createGetResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
} else {
return DataCommandResult.createGetResult(key, array[1], null, null, false);
}
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionName);
+ }
return DataCommandResult.createGetInfoResult(key, null, null,
CliStrings.GET__MSG__KEY_NOT_FOUND_REGION, false);
}
@@ -510,71 +511,72 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
InternalCache cache = getCache();
- if (regionPath == null || regionPath.isEmpty()) {
+ if (StringUtils.isEmpty(regionPath)) {
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false);
}
-
- List<Region> listofRegionStartingwithRegionPath = new ArrayList<Region>();
+ List<Region> listOfRegionsStartingWithRegionPath = new ArrayList<>();
if (recursive) {
// Recursively find the keys starting from the specified region path.
List<String> regionPaths = getAllRegionPaths(cache, true);
- for (int i = 0; i < regionPaths.size(); i++) {
- String path = regionPaths.get(i);
+ for (String path : regionPaths) {
if (path.startsWith(regionPath) || path.startsWith(Region.SEPARATOR + regionPath)) {
Region targetRegion = cache.getRegion(path);
- listofRegionStartingwithRegionPath.add(targetRegion);
+ listOfRegionsStartingWithRegionPath.add(targetRegion);
}
}
- if (listofRegionStartingwithRegionPath.size() == 0) {
- if (logger.isDebugEnabled())
+ if (listOfRegionsStartingWithRegionPath.size() == 0) {
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionPath);
+ }
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionPath), false);
}
} else {
Region region = cache.getRegion(regionPath);
if (region == null) {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Region Not Found - {}", regionPath);
+ }
return DataCommandResult.createLocateEntryResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND, regionPath), false);
- } else
- listofRegionStartingwithRegionPath.add(region);
+ } else {
+ listOfRegionsStartingWithRegionPath.add(region);
+ }
}
- Object keyObject = null;
+ Object keyObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
- logger.fatal(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
return DataCommandResult.createLocateEntryResult(key, null, null,
"ClassNotFoundException " + keyClass, false);
} catch (IllegalArgumentException e) {
- logger.fatal(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
return DataCommandResult.createLocateEntryResult(key, null, null,
"Error in converting JSON " + e.getMessage(), false);
}
- Object value = null;
- DataCommandResult.KeyInfo keyInfo = null;
+ Object value;
+ DataCommandResult.KeyInfo keyInfo;
keyInfo = new DataCommandResult.KeyInfo();
DistributedMember member = cache.getDistributedSystem().getDistributedMember();
keyInfo.setHost(member.getHost());
keyInfo.setMemberId(member.getId());
keyInfo.setMemberName(member.getName());
- for (Region region : listofRegionStartingwithRegionPath) {
+ for (Region region : listOfRegionsStartingWithRegionPath) {
if (region instanceof PartitionedRegion) {
// Following code is adaptation of which.java of old Gfsh
PartitionedRegion pr = (PartitionedRegion) region;
- Region localRegion = PartitionRegionHelper.getLocalData((PartitionedRegion) region);
+ Region localRegion = PartitionRegionHelper.getLocalData(region);
value = localRegion.get(keyObject);
if (value != null) {
DistributedMember primaryMember =
@@ -584,24 +586,28 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
keyInfo.addLocation(new Object[] {region.getFullPath(), true,
getJSONForNonPrimitiveObject(value)[1], isPrimary, "" + bucketId});
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionPath);
+ }
return DataCommandResult.createLocateEntryInfoResult(key, null, null,
CliStrings.LOCATE_ENTRY__MSG__KEY_NOT_FOUND_REGION, false);
}
} else {
if (region.containsKey(keyObject)) {
value = region.get(keyObject);
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Get for key {} value {} in region {}", key, value, region.getFullPath());
- if (value != null)
+ }
+ if (value != null) {
keyInfo.addLocation(new Object[] {region.getFullPath(), true,
getJSONForNonPrimitiveObject(value)[1], false, null});
- else
+ } else {
keyInfo.addLocation(new Object[] {region.getFullPath(), false, null, false, null});
+ }
} else {
- if (logger.isDebugEnabled())
+ if (logger.isDebugEnabled()) {
logger.debug("Key is not present in the region {}", regionPath);
+ }
keyInfo.addLocation(new Object[] {region.getFullPath(), false, null, false, null});
}
}
@@ -619,17 +625,17 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
public DataCommandResult put(String key, String value, boolean putIfAbsent, String keyClass,
String valueClass, String regionName) {
- if (regionName == null || regionName.isEmpty()) {
+ if (StringUtils.isEmpty(regionName)) {
return DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__REGIONNAME_EMPTY, false);
}
- if (key == null || key.isEmpty()) {
+ if (StringUtils.isEmpty(key)) {
return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__KEY_EMPTY,
false);
}
- if (value == null || value.isEmpty()) {
+ if (StringUtils.isEmpty(value)) {
return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__VALUE_EMPTY,
false);
}
@@ -640,8 +646,8 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
return DataCommandResult.createPutResult(key, null, null,
CliStrings.format(CliStrings.PUT__MSG__REGION_NOT_FOUND, regionName), false);
} else {
- Object keyObject = null;
- Object valueObject = null;
+ Object keyObject;
+ Object valueObject;
try {
keyObject = getClassObject(key, keyClass);
} catch (ClassNotFoundException e) {
@@ -659,14 +665,16 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
"ClassNotFoundException " + valueClass, false);
}
Object returnValue;
- if (putIfAbsent && region.containsKey(keyObject))
+ if (putIfAbsent && region.containsKey(keyObject)) {
returnValue = region.get(keyObject);
- else
+ } else {
returnValue = region.put(keyObject, valueObject);
+ }
Object array[] = getJSONForNonPrimitiveObject(returnValue);
DataCommandResult result = DataCommandResult.createPutResult(key, array[1], null, null, true);
- if (array[0] != null)
+ if (array[0] != null) {
result.setValueClass((String) array[0]);
+ }
return result;
}
}
@@ -674,53 +682,40 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings({"rawtypes", "unchecked"})
private Object getClassObject(String string, String klassString)
throws ClassNotFoundException, IllegalArgumentException {
- if (klassString == null || klassString.isEmpty())
+ if (StringUtils.isEmpty(klassString)) {
return string;
- else {
- Object o = null;
- Class klass = ClassPathLoader.getLatest().forName(klassString);
-
- if (klass.equals(String.class))
- return string;
+ }
+ Class klass = ClassPathLoader.getLatest().forName(klassString);
- if (JsonUtil.isPrimitiveOrWrapper(klass)) {
- try {
- if (klass.equals(Byte.class)) {
- o = Byte.parseByte(string);
- return o;
- } else if (klass.equals(Short.class)) {
- o = Short.parseShort(string);
- return o;
- } else if (klass.equals(Integer.class)) {
- o = Integer.parseInt(string);
- return o;
- } else if (klass.equals(Long.class)) {
- o = Long.parseLong(string);
- return o;
- } else if (klass.equals(Double.class)) {
- o = Double.parseDouble(string);
- return o;
- } else if (klass.equals(Boolean.class)) {
- o = Boolean.parseBoolean(string);
- return o;
- } else if (klass.equals(Float.class)) {
- o = Float.parseFloat(string);
- return o;
- }
- return o;
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException(
- "Failed to convert input key to " + klassString + " Msg : " + e.getMessage());
- }
- }
+ if (klass.equals(String.class)) {
+ return string;
+ }
+ if (JsonUtil.isPrimitiveOrWrapper(klass)) {
try {
- o = getObjectFromJson(string, klass);
- return o;
- } catch (IllegalArgumentException e) {
- throw e;
+ if (klass.equals(Byte.class)) {
+ return Byte.parseByte(string);
+ } else if (klass.equals(Short.class)) {
+ return Short.parseShort(string);
+ } else if (klass.equals(Integer.class)) {
+ return Integer.parseInt(string);
+ } else if (klass.equals(Long.class)) {
+ return Long.parseLong(string);
+ } else if (klass.equals(Double.class)) {
+ return Double.parseDouble(string);
+ } else if (klass.equals(Boolean.class)) {
+ return Boolean.parseBoolean(string);
+ } else if (klass.equals(Float.class)) {
+ return Float.parseFloat(string);
+ }
+ return null;
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(
+ "Failed to convert input key to " + klassString + " Msg : " + e.getMessage());
}
}
+
+ return getObjectFromJson(string, klass);
}
@SuppressWarnings({"rawtypes"})
@@ -803,10 +798,11 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
sb.append("{").append(newString.substring(1, len - 1)).append("}");
newString = sb.toString();
}
- V v = JsonUtil.jsonToObject(newString, klass);
- return v;
+ return JsonUtil.jsonToObject(newString, klass);
}
+
+
/**
* Returns a sorted list of all region full paths found in the specified cache.
*
@@ -822,18 +818,17 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
// get a list of all root regions
- Set regions = cache.rootRegions();
- Iterator itor = regions.iterator();
+ Set<Region<?, ?>> regions = cache.rootRegions();
- while (itor.hasNext()) {
- String regionPath = ((Region) itor.next()).getFullPath();
+ for (Region rootRegion : regions) {
+ String regionPath = rootRegion.getFullPath();
Region region = cache.getRegion(regionPath);
list.add(regionPath);
- Set subregionSet = region.subregions(true);
+ Set<Region> subregionSet = region.subregions(true);
if (recursive) {
- for (Iterator subIter = subregionSet.iterator(); subIter.hasNext();) {
- list.add(((Region) subIter.next()).getFullPath());
+ for (Region aSubregionSet : subregionSet) {
+ list.add(aSubregionSet.getFullPath());
}
}
}
@@ -856,7 +851,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
int startCount = args.getInt(DataCommandResult.QUERY_PAGE_START);
int endCount = args.getInt(DataCommandResult.QUERY_PAGE_END);
int rows = args.getInt(DataCommandResult.NUM_ROWS); // returns Zero if no rows added so it
- // works.
+ // works.
boolean flag = args.getBoolean(DataCommandResult.RESULT_FLAG);
CommandResult commandResult = CLIMultiStepHelper.getDisplayResultFromArgs(args);
Gfsh.println();
@@ -865,7 +860,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
if (flag) {
- boolean paginationNeeded = (startCount < rows) && (endCount < rows) && interactive && flag;
+ boolean paginationNeeded = startCount < rows && endCount < rows && interactive;
if (paginationNeeded) {
while (true) {
String message = ("Press n to move to next page, q to quit and p to previous page : ");
@@ -879,17 +874,19 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
new Object[] {nextStart, (nextStart + getPageSize())}, SELECT_STEP_MOVE);
} else if ("p".equals(step)) {
int nextStart = startCount - getPageSize();
- if (nextStart < 0)
+ if (nextStart < 0) {
nextStart = 0;
+ }
return CLIMultiStepHelper.createBannerResult(
new String[] {DataCommandResult.QUERY_PAGE_START,
DataCommandResult.QUERY_PAGE_END},
new Object[] {nextStart, (nextStart + getPageSize())}, SELECT_STEP_MOVE);
- } else if ("q".equals(step))
+ } else if ("q".equals(step)) {
return CLIMultiStepHelper.createBannerResult(new String[] {}, new Object[] {},
SELECT_STEP_END);
- else
+ } else {
Gfsh.println("Unknown option ");
+ }
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -916,7 +913,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
int endCount = args.getInt(DataCommandResult.QUERY_PAGE_END);
return cachedResult.pageResult(startCount, endCount, SELECT_STEP_DISPLAY);
}
- };
+ }
public static class SelectExecStep extends CLIMultiStepHelper.RemoteStep {
@@ -938,21 +935,23 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
if (interactive) {
endCount = getPageSize();
} else {
- if (result.getSelectResult() != null)
+ if (result.getSelectResult() != null) {
endCount = result.getSelectResult().size();
+ }
}
- if (interactive)
+ if (interactive) {
return result.pageResult(0, endCount, SELECT_STEP_DISPLAY);
- else
+ } else {
return CLIMultiStepHelper.createBannerResult(new String[] {}, new Object[] {},
SELECT_STEP_END);
+ }
}
public DataCommandResult _select(String query) {
InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (query == null || query.isEmpty()) {
+ if (StringUtils.isEmpty(query)) {
dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
CliStrings.QUERY__MSG__QUERY_EMPTY, false);
return dataResult;
@@ -964,15 +963,15 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
@SuppressWarnings("deprecation")
QCompiler compiler = new QCompiler();
- Set<String> regionsInQuery = null;
+ Set<String> regionsInQuery;
try {
CompiledValue compiledQuery = compiler.compileQuery(query);
- Set<String> regions = new HashSet<String>();
+ Set<String> regions = new HashSet<>();
compiledQuery.getRegionsInQuery(regions, null);
// authorize data read on these regions
for (String region : regions) {
- this.securityService.authorizeRegionRead(region);
+ securityService.authorizeRegionRead(region);
}
regionsInQuery = Collections.unmodifiableSet(regions);
@@ -984,38 +983,38 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.QUERY);
request.setQuery(query);
- Subject subject = this.securityService.getSubject();
+ Subject subject = securityService.getSubject();
if (subject != null) {
- request.setPrincipal((Serializable) subject.getPrincipal());
+ request.setPrincipal(subject.getPrincipal());
}
dataResult = DataCommands.callFunctionForRegion(request, function, members);
dataResult.setInputQuery(query);
- return (dataResult);
+ return dataResult;
} else {
- return (dataResult =
- DataCommandResult.createSelectInfoResult(null, null, -1, null, CliStrings.format(
- CliStrings.QUERY__MSG__REGIONS_NOT_FOUND, regionsInQuery.toString()), false));
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null, CliStrings.format(
+ CliStrings.QUERY__MSG__REGIONS_NOT_FOUND, regionsInQuery.toString()), false);
}
} else {
- return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY,
"Region mentioned in query probably missing /"),
- false));
+ false);
}
} catch (QueryInvalidException qe) {
logger.error("{} Failed Error {}", query, qe.getMessage(), qe);
- return (dataResult = DataCommandResult.createSelectInfoResult(null, null, -1, null,
- CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, qe.getMessage()), false));
+ return DataCommandResult.createSelectInfoResult(null, null, -1, null,
+ CliStrings.format(CliStrings.QUERY__MSG__INVALID_QUERY, qe.getMessage()), false);
}
}
private String addLimit(String query) {
if (StringUtils.containsIgnoreCase(query, " limit")
- || StringUtils.containsIgnoreCase(query, " count("))
+ || StringUtils.containsIgnoreCase(query, " count(")) {
return query;
+ }
return query + " limit " + getFetchSize();
}
- };
+ }
public static class SelectQuitStep extends CLIMultiStepHelper.RemoteStep {
@@ -1031,20 +1030,20 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
GfJsonObject args = CLIMultiStepHelper.getStepArgs();
DataCommandResult dataResult = cachedResult;
cachedResult = null;
- if (interactive)
+ if (interactive) {
return CLIMultiStepHelper.createEmptyResult("END");
- else {
+ } else {
CompositeResultData rd = dataResult.toSelectCommandResult();
SectionResultData section = rd.addSection(CLIMultiStepHelper.STEP_SECTION);
section.addData(CLIMultiStepHelper.NEXT_STEP_NAME, "END");
return ResultBuilder.buildResult(rd);
}
}
- };
+ }
public static int getPageSize() {
int pageSize = -1;
- Map<String, String> session = null;
+ Map<String, String> session;
if (CliUtil.isGfshVM()) {
session = Gfsh.getCurrentInstance().getEnv();
} else {
@@ -1052,13 +1051,15 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
}
if (session != null) {
String size = session.get(Gfsh.ENV_APP_COLLECTION_LIMIT);
- if (size == null || size.isEmpty())
+ if (StringUtils.isEmpty(size)) {
pageSize = Gfsh.DEFAULT_APP_COLLECTION_LIMIT;
- else
+ } else {
pageSize = Integer.parseInt(size);
+ }
}
- if (pageSize == -1)
+ if (pageSize == -1) {
pageSize = Gfsh.DEFAULT_APP_COLLECTION_LIMIT;
+ }
return pageSize;
}
@@ -1068,7 +1069,6 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
public static String getLogMessage(QueryObserver observer, long startTime, String query) {
String usedIndexesString = null;
- String rowCountString = null;
float time = 0.0f;
if (startTime > 0L) {
@@ -1087,7 +1087,7 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
buf.append(":");
for (Iterator itr = usedIndexes.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry) itr.next();
- buf.append(entry.getKey().toString() + entry.getValue());
+ buf.append(entry.getKey().toString()).append(entry.getValue());
if (itr.hasNext()) {
buf.append(",");
}
@@ -1099,9 +1099,8 @@ public class DataCommandFunction extends FunctionAdapter implements InternalEnti
+ observer.getClass().getName() + ")";
}
- return "Query Executed" + (startTime > 0L ? " in " + time + " ms;" : ";")
- + (rowCountString != null ? rowCountString : "")
- + (usedIndexesString != null ? usedIndexesString : "");
+ return String.format("Query Executed%s%s", startTime > 0L ? " in " + time + " ms;" : ";",
+ usedIndexesString != null ? usedIndexesString : "");
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
index e72654e..fa1e4a5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TabularResultData.java
@@ -14,20 +14,14 @@
*/
package org.apache.geode.management.internal.cli.result;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.geode.management.internal.cli.json.GfJsonArray;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import java.util.ArrayList;
+import java.util.List;
+
/**
- *
- *
* @since GemFire 7.0
*/
public class TabularResultData extends AbstractResultData {
@@ -70,8 +64,7 @@ public class TabularResultData extends AbstractResultData {
}
/**
- *
- * @param headerText
+ * @param headerText Text to set to header.
* @return this TabularResultData
* @throws ResultDataException If the value is non-finite number or if the key is null.
*/
@@ -80,8 +73,7 @@ public class TabularResultData extends AbstractResultData {
}
/**
- *
- * @param footerText
+ * @param footerText Text to set to footer.
* @return this TabularResultData
* @throws ResultDataException If the value is non-finite number or if the key is null.
*/
@@ -99,62 +91,8 @@ public class TabularResultData extends AbstractResultData {
return gfJsonObject.getString(RESULT_FOOTER);
}
- public Map<String, String> retrieveDataByValueInColumn(String columnName, String valueToSearch) {
- Map<String, String> foundValues = Collections.emptyMap();
- try {
- GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
- int size = jsonArray.size();
- int foundIndex = -1;
- for (int i = 0; i < size; i++) {
- Object object = jsonArray.get(i);
- if (object != null && object.equals(valueToSearch)) {
- foundIndex = i;
- break;
- }
- }
-
- if (foundIndex != -1) {
- foundValues = new LinkedHashMap<String, String>();
- for (Iterator<String> iterator = contentObject.keys(); iterator.hasNext();) {
- String storedColumnNames = (String) iterator.next();
- GfJsonArray storedColumnValues = contentObject.getJSONArray(storedColumnNames);
- foundValues.put(storedColumnNames, String.valueOf(storedColumnValues.get(foundIndex)));
- }
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return foundValues;
- }
-
- public List<Map<String, String>> retrieveAllDataByValueInColumn(String columnName,
- String valueToSearch) {
- List<Map<String, String>> foundValuesList = new ArrayList<Map<String, String>>();
- try {
- GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
- int size = jsonArray.size();
- for (int i = 0; i < size; i++) {
- Object object = jsonArray.get(i);
- if (object != null && object.equals(valueToSearch)) {
- Map<String, String> foundValues = new LinkedHashMap<String, String>();
-
- for (Iterator<String> iterator = contentObject.keys(); iterator.hasNext();) {
- String storedColumnNames = (String) iterator.next();
- GfJsonArray storedColumnValues = contentObject.getJSONArray(storedColumnNames);
- foundValues.put(storedColumnNames, String.valueOf(storedColumnValues.get(i)));
- }
-
- foundValuesList.add(foundValues);
- }
- }
- } catch (GfJsonException e) {
- throw new ResultDataException(e.getMessage());
- }
- return foundValuesList;
- }
-
public List<String> retrieveAllValues(String columnName) {
- List<String> values = new ArrayList<String>();
+ List<String> values = new ArrayList<>();
try {
GfJsonArray jsonArray = contentObject.getJSONArray(columnName);
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
index 1af6261..eff4d29 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
@@ -14,19 +14,17 @@
*/
package org.apache.geode.cache.query.dunit;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.junit.experimental.categories.Category;
import org.junit.Test;
import static org.junit.Assert.*;
import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
import java.util.Properties;
-import org.junit.experimental.categories.Category;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.CacheFactory;
@@ -38,16 +36,13 @@ import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.query.Index;
-import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.data.Portfolio;
import org.apache.geode.cache.query.data.Position;
import org.apache.geode.cache.query.internal.QueryObserverHolder;
import org.apache.geode.cache.query.internal.index.IndexManager;
-import org.apache.geode.cache.query.partitioned.PRQueryDUnitHelper;
import org.apache.geode.cache30.CacheSerializableRunnable;
-import org.apache.geode.cache30.CacheTestCase;
import org.apache.geode.internal.cache.execute.PRClientServerTestBase;
import org.apache.geode.test.dunit.Assert;
import org.apache.geode.test.dunit.AsyncInvocation;
@@ -92,17 +87,14 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
public static volatile boolean hooked = false;
- /**
- * @param name
- */
public QueryDataInconsistencyDUnitTest() {
super();
}
@Override
public final void postTearDownCacheTestCase() throws Exception {
- Invoke.invokeInEveryVM(() -> disconnectFromDS());
- Invoke.invokeInEveryVM(() -> QueryObserverHolder.reset());
+ Invoke.invokeInEveryVM(JUnit4DistributedTestCase::disconnectFromDS);
+ Invoke.invokeInEveryVM(QueryObserverHolder::reset);
}
@Override
@@ -544,8 +536,8 @@ public class QueryDataInconsistencyDUnitTest extends JUnit4CacheTestCase {
}
private void createCacheClientWithoutReg(String host, Integer port1) {
- this.disconnectFromDS();
- ClientCache cache = new ClientCacheFactory().addPoolServer(host, port1).create();
+ disconnectFromDS();
+ new ClientCacheFactory().addPoolServer(host, port1).create();
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index 2af3fea..14d4d3f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -218,8 +218,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
}
});
- final String vm1MemberId = (String) vm1.invoke(() -> getMemberId());
- final String vm2MemberId = (String) vm2.invoke(() -> getMemberId());
+ final String vm1MemberId = vm1.invoke(() -> getMemberId());
+ final String vm2MemberId = vm2.invoke(() -> getMemberId());
getLogWriter().info("Vm1 ID : " + vm1MemberId);
getLogWriter().info("Vm2 ID : " + vm2MemberId);
@@ -457,9 +457,13 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
doQueryRegionsAssociatedMembers(queryTemplate1, -1, false,
new String[] {DATA_PAR_REGION_NAME_VM2_PATH, "/jfgkdfjgkd"}); // one wrong region
doQueryRegionsAssociatedMembers(queryTemplate1, -1, true,
- new String[] {"/dhgfdhgf", "/dhgddhd"}); // both regions wrong
+ new String[] {"/dhgfdhgf", "/dhgddhd"}); // both
+ // regions
+ // wrong
doQueryRegionsAssociatedMembers(queryTemplate1, -1, false,
- new String[] {"/dhgfdhgf", "/dhgddhd"}); // both regions wrong
+ new String[] {"/dhgfdhgf", "/dhgddhd"}); // both
+ // regions
+ // wrong
}
});
}
@@ -1961,13 +1965,9 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
return false;
} else {
// verify that bean is proper before executing tests
- if (bean.getMembers() != null && bean.getMembers().length > 1
+ return bean.getMembers() != null && bean.getMembers().length > 1
&& bean.getMemberCount() > 0
- && service.getDistributedSystemMXBean().listRegions().length >= 2) {
- return true;
- } else {
- return false;
- }
+ && service.getDistributedSystemMXBean().listRegions().length >= 2;
}
}
@@ -2037,7 +2037,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(checkRegionMBeans);
- getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executin command");
+ getLogWriter().info("testRebalanceCommandForSimulate verified Mbean and executing command");
String command = "rebalance --simulate=true --include-region=" + "/" + REBALANCE_REGION_NAME;
CommandResult cmdResult = executeCommand(command);
getLogWriter().info("testRebalanceCommandForSimulate just after executing " + cmdResult);
@@ -2298,11 +2298,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
getLogWriter().info(
"waitForListClientMbean Still probing for DistributedRegionMXBean with separator Not null "
+ bean2.getMembers().length);
- if (bean2.getMembers().length > 1) {
- return true;
- } else {
- return false;
- }
+ return bean2.getMembers().length > 1;
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
new file mode 100644
index 0000000..a9a29a0
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DataCommandFunctionWithPDXJUnitTest.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.apache.geode.management.internal.cli.domain.DataCommandResult.MISSING_VALUE;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.management.internal.cli.domain.DataCommandRequest;
+import org.apache.geode.management.internal.cli.domain.DataCommandResult;
+import org.apache.geode.management.internal.cli.json.GfJsonArray;
+import org.apache.geode.management.internal.cli.json.GfJsonException;
+import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import org.apache.geode.management.internal.cli.result.CompositeResultData;
+import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.pdx.PdxReader;
+import org.apache.geode.pdx.PdxSerializable;
+import org.apache.geode.pdx.PdxWriter;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(IntegrationTest.class)
+public class DataCommandFunctionWithPDXJUnitTest {
+ private static final String PARTITIONED_REGION = "part_region";
+
+ @Rule
+ public ServerStarterRule server = new ServerStarterRule().withPDXPersistent()
+ .withRegion(RegionShortcut.PARTITION, PARTITIONED_REGION);
+
+ private Customer alice;
+ private Customer bob;
+ private CustomerWithPhone charlie;
+ private CustomerWithPhone dan;
+
+ @Before
+ public void setup() {
+ alice = new Customer("0", "Alice", "Anderson");
+ bob = new Customer("1", "Bob", "Bailey");
+ charlie = new CustomerWithPhone("2", "Charlie", "Chaplin", "(222) 222-2222");
+ dan = new CustomerWithPhone("3", "Dan", "Dickinson", "(333) 333-3333");
+
+ Region region = server.getCache().getRegion(PARTITIONED_REGION);
+ region.put(0, alice);
+ region.put(1, bob);
+ region.put(2, charlie);
+ region.put(3, dan);
+ }
+
+ // GEODE-2662: building a table where early values are missing keys causes the data to shift
+ // upward during reporting.
+ @Test
+ public void testTableIsRectangular() throws GfJsonException {
+ TabularResultData rawTable = getTableFromQuery("select * from /" + PARTITIONED_REGION);
+ // Verify any table built
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ // Verify table is rectangular
+ SoftAssertions softly = new SoftAssertions();
+ for (String k : new String[] {"id", "phone", "firstName", "lastName"}) {
+ softly.assertThat(tableJson.getJSONArray(k).size()).isEqualTo(4);
+ }
+ softly.assertAll();
+ }
+
+ @Test
+ public void testVerifyDataDoesNotShift() throws Exception {
+ TabularResultData rawTable =
+ getTableFromQuery("select * from /" + PARTITIONED_REGION + " order by id");
+ // Verify any table built
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ // Table only contains correct keys
+ assertThat(tableJson.getJSONArray("missingKey")).isNull();
+
+ // Table contains correct data
+ assertThatRowIsBuiltCorrectly(tableJson, 0, alice);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, bob);
+ assertThatRowIsBuiltCorrectly(tableJson, 2, charlie);
+ assertThatRowIsBuiltCorrectly(tableJson, 3, dan);
+ }
+
+ @Test
+ public void testFilteredQueryWithPhone() throws Exception {
+ TabularResultData rawTable = getTableFromQuery(
+ "select * from /" + PARTITIONED_REGION + " c where IS_DEFINED ( c.phone ) order by id");
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ for (String k : new String[] {"id", "phone", "firstName", "lastName"}) {
+ assertThat(tableJson.getJSONArray(k).size()).isEqualTo(2);
+ }
+ assertThatRowIsBuiltCorrectly(tableJson, 0, charlie);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, dan);
+ }
+
+
+ @Test
+ public void testFilteredQueryWithoutPhone() throws Exception {
+ TabularResultData rawTable = getTableFromQuery(
+ "select * from /" + PARTITIONED_REGION + " c where IS_UNDEFINED ( c.phone ) order by id");
+ assertThat(rawTable.getGfJsonObject()).isNotNull();
+ assertThat(rawTable.getGfJsonObject().getJSONObject("content")).isNotNull();
+ GfJsonObject tableJson = rawTable.getGfJsonObject().getJSONObject("content");
+ for (String k : new String[] {"id", "firstName", "lastName"}) {
+ assertThat(tableJson.getJSONArray(k).size()).isEqualTo(2);
+ }
+ assertThatRowIsBuiltCorrectly(tableJson, 0, alice);
+ assertThatRowIsBuiltCorrectly(tableJson, 1, bob);
+ }
+
+ private TabularResultData getTableFromQuery(String query) {
+ DataCommandRequest request = new DataCommandRequest();
+ request.setQuery(query);
+ DataCommandResult result = new DataCommandFunction().select(request);
+ CompositeResultData r = result.toSelectCommandResult();
+ return r.retrieveSectionByIndex(0).retrieveTableByIndex(0);
+ }
+
+
+ private void assertThatRowIsBuiltCorrectly(GfJsonObject table, int rowNum, Customer customer)
+ throws Exception {
+ SoftAssertions softly = new SoftAssertions();
+ String id = (String) table.getJSONArray("id").get(rowNum);
+ String firstName = (String) table.getJSONArray("firstName").get(rowNum);
+ String lastName = (String) table.getJSONArray("lastName").get(rowNum);
+
+ softly.assertThat(id).describedAs("Customer ID").isEqualTo(customer.id);
+ softly.assertThat(firstName).describedAs("First name").isEqualTo(customer.firstName);
+ softly.assertThat(lastName).describedAs("Last name").isEqualTo(customer.lastName);
+
+ GfJsonArray phoneArray = table.getJSONArray("phone");
+
+ if (phoneArray == null) {
+ softly.assertThat(customer).describedAs("No phone data")
+ .isNotInstanceOf(CustomerWithPhone.class);
+ } else {
+ String phone = (String) phoneArray.get(rowNum);
+
+ if (customer instanceof CustomerWithPhone) {
+ softly.assertThat(phone).describedAs("Phone")
+ .isEqualTo(((CustomerWithPhone) customer).phone);
+ } else {
+ softly.assertThat(phone).describedAs("Phone (missing)").isEqualTo(MISSING_VALUE);
+ }
+ }
+ softly.assertAll();
+ }
+
+ public static class Customer implements PdxSerializable {
+ protected String id;
+ protected String firstName;
+ protected String lastName;
+
+ Customer() {}
+
+ Customer(String id, String firstName, String lastName) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ @Override
+ public void toData(PdxWriter writer) {
+ writer.writeString("id", id).markIdentityField("id").writeString("firstName", firstName)
+ .writeString("lastName", lastName);
+ }
+
+ @Override
+ public void fromData(PdxReader reader) {
+ id = reader.readString("id");
+ firstName = reader.readString("firstName");
+ lastName = reader.readString("lastName");
+ }
+ }
+
+ public static class CustomerWithPhone extends Customer {
+ private String phone;
+
+ CustomerWithPhone(String id, String firstName, String lastName, String phone) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.phone = phone;
+ }
+
+ @Override
+ public void toData(PdxWriter writer) {
+ writer.writeString("id", id).markIdentityField("id").writeString("firstName", firstName)
+ .writeString("lastName", lastName).writeString("phone", phone);
+ }
+
+ @Override
+ public void fromData(PdxReader reader) {
+ id = reader.readString("id");
+ firstName = reader.readString("firstName");
+ lastName = reader.readString("lastName");
+ phone = reader.readString("phone");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
index ead1047..30ae59f 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/ServerStarterRule.java
@@ -54,6 +54,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
private transient Cache cache;
private transient CacheServer server;
private int embeddedLocatorPort = -1;
+ private boolean pdxPersistent = false;
private Map<String, RegionShortcut> regions = new HashMap<>();
@@ -107,6 +108,13 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
}
}
+ public ServerStarterRule withPDXPersistent() {
+ pdxPersistent = true;
+ return this;
+ }
+
+
+
public ServerStarterRule withEmbeddedLocator() {
embeddedLocatorPort = AvailablePortHelper.getRandomAvailableTCPPort();
properties.setProperty("start-locator", "localhost[" + embeddedLocatorPort + "]");
@@ -127,9 +135,6 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
return this;
}
- public void startServer() {
- startServer(false);
- }
public ServerStarterRule withRegion(RegionShortcut type, String name) {
this.autoStart = true;
@@ -141,7 +146,7 @@ public class ServerStarterRule extends MemberStarterRule<ServerStarterRule> impl
withProperties(properties).withConnectionToLocator(locatorPort).startServer();
}
- public void startServer(boolean pdxPersistent) {
+ public void startServer() {
CacheFactory cf = new CacheFactory(this.properties);
cf.setPdxReadSerialized(pdxPersistent);
cf.setPdxPersistent(pdxPersistent);
[02/28] geode git commit: GEODE-2662: Gfsh displays field value on
wrong line when receiving objects with missing fields
Posted by kl...@apache.org.
GEODE-2662: Gfsh displays field value on wrong line when receiving objects with missing fields
* DataCommandResult.buildTable refactored to scan for all necessary fields and build rows, padding with MISSING_VALUE as necessary.
* ServerStarterRule adjusted to build .withPDXPersistent() rather than take it as input to .startServer()
* Refactored a great deal for readability.
* this closes #500
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/9af854aa
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/9af854aa
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/9af854aa
Branch: refs/heads/feature/GEODE-2632-16
Commit: 9af854aa4ec1b32b4668c4faa2f225f267590239
Parents: da6c28c
Author: Patrick Rhomberg <pr...@pivotal.io>
Authored: Tue May 2 11:09:35 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 19 08:09:57 2017 -0700
----------------------------------------------------------------------
geode-core/build.gradle | 4 +-
.../internal/cli/commands/DataCommands.java | 484 ++++++++--------
.../internal/cli/domain/DataCommandResult.java | 554 ++++++++++---------
.../cli/functions/DataCommandFunction.java | 533 +++++++++---------
.../internal/cli/result/TabularResultData.java | 74 +--
.../dunit/QueryDataInconsistencyDUnitTest.java | 18 +-
.../commands/GemfireDataCommandsDUnitTest.java | 28 +-
.../DataCommandFunctionWithPDXJUnitTest.java | 220 ++++++++
.../test/dunit/rules/ServerStarterRule.java | 13 +-
9 files changed, 1060 insertions(+), 868 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index f07444a..0297146 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -113,8 +113,7 @@ dependencies {
compile 'commons-beanutils:commons-beanutils:' + project.'commons-beanutils.version'
// https://mvnrepository.com/artifact/io.github.lukehutch/fast-classpath-scanner
- compile 'io.github.lukehutch:fast-classpath-scanner:' + project.'fast-classpath-scanner.version'
-
+ compile 'io.github.lukehutch:fast-classpath-scanner:' + project.'fast-classpath-scanner.version'
compile project(':geode-common')
@@ -127,7 +126,6 @@ dependencies {
// Test Dependencies
// External
- testCompile 'com.google.guava:guava:' + project.'guava.version'
testCompile 'com.jayway.jsonpath:json-path-assert:' + project.'json-path-assert.version'
testCompile 'org.apache.bcel:bcel:' + project.'bcel.version'
testRuntime 'org.apache.derby:derby:' + project.'derby.version'
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
index 89db5d1..a38e545 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DataCommands.java
@@ -14,27 +14,9 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.apache.shiro.subject.Subject;
-import org.springframework.shell.core.CommandMarker;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
@@ -79,6 +61,26 @@ import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.apache.shiro.subject.Subject;
+import org.springframework.shell.core.CommandMarker;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* @since GemFire 7.0
@@ -118,8 +120,8 @@ public class DataCommands implements CommandMarker {
help = CliStrings.REBALANCE__SIMULATE__HELP) boolean simulate) {
ExecutorService commandExecutors = Executors.newSingleThreadExecutor();
- List<Future<Result>> commandResult = new ArrayList<Future<Result>>();
- Result result = null;
+ List<Future<Result>> commandResult = new ArrayList<>();
+ Result result;
try {
commandResult.add(commandExecutors
.submit(new ExecuteRebalanceWithTimeout(includeRegions, excludeRegions, simulate)));
@@ -165,16 +167,16 @@ public class DataCommands implements CommandMarker {
Result result = null;
try {
- RebalanceOperation op = null;
+ RebalanceOperation op;
- if (includeRegions != null && includeRegions.length > 0) {
- CompositeResultData rebalanceResulteData = ResultBuilder.createCompositeResultData();
+ if (ArrayUtils.isNotEmpty(includeRegions)) {
+ CompositeResultData rebalanceResultData = ResultBuilder.createCompositeResultData();
int index = 0;
for (String regionName : includeRegions) {
// To be removed after region Name specification with "/" is fixed
- regionName = regionName.startsWith("/") == true ? regionName : ("/" + regionName);
+ regionName = regionName.startsWith("/") ? regionName : ("/" + regionName);
Region region = cache.getRegion(regionName);
if (region == null) {
@@ -189,21 +191,18 @@ public class DataCommands implements CommandMarker {
Function rebalanceFunction = new RebalanceFunction();
Object[] functionArgs = new Object[3];
functionArgs[0] = simulate ? "true" : "false";
- Set<String> setRegionName = new HashSet<String>();
+ Set<String> setRegionName = new HashSet<>();
setRegionName.add(regionName);
functionArgs[1] = setRegionName;
- Set<String> excludeRegionSet = new HashSet<String>();
- if (excludeRegions != null && excludeRegions.length > 0) {
-
- for (String str : excludeRegions) {
- excludeRegionSet.add(str);
- }
+ Set<String> excludeRegionSet = new HashSet<>();
+ if (ArrayUtils.isNotEmpty(excludeRegions)) {
+ Collections.addAll(excludeRegionSet, excludeRegions);
}
functionArgs[2] = excludeRegionSet;
- if (simulate == true) {
- List resultList = null;
+ if (simulate) {
+ List resultList;
try {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, member).getResult();
@@ -212,24 +211,24 @@ public class DataCommands implements CommandMarker {
.info(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1,
member.getId(), ex.getMessage()), ex);
- rebalanceResulteData.addSection()
+ rebalanceResultData.addSection()
.addData(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception,
member.getId()), ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
- if (checkResultList(rebalanceResulteData, resultList, member) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, member)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, true, cache));
} else {
- List resultList = null;
+ List resultList;
try {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, member).getResult();
@@ -238,47 +237,47 @@ public class DataCommands implements CommandMarker {
.info(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception_1,
member.getId(), ex.getMessage()), ex);
- rebalanceResulteData.addSection()
+ rebalanceResultData.addSection()
.addData(CliStrings.format(
CliStrings.REBALANCE__MSG__EXCEPTION_IN_REBALANCE_FOR_MEMBER_0_Exception,
member.getId()), ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
- if (checkResultList(rebalanceResulteData, resultList, member) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, member)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, false, cache));
}
} else {
+
ResourceManager manager = cache.getResourceManager();
RebalanceFactory rbFactory = manager.createRebalanceFactory();
- Set<String> excludeRegionSet = new HashSet<String>();
+ Set<String> excludeRegionSet = new HashSet<>();
if (excludeRegions != null) {
- for (String excludeRegion : excludeRegions)
- excludeRegionSet.add(excludeRegion);
+ Collections.addAll(excludeRegionSet, excludeRegions);
}
rbFactory.excludeRegions(excludeRegionSet);
- Set<String> includeRegionSet = new HashSet<String>();
+ Set<String> includeRegionSet = new HashSet<>();
includeRegionSet.add(regionName);
rbFactory.includeRegions(includeRegionSet);
- if (simulate == true) {
+ if (simulate) {
op = manager.createRebalanceFactory().simulate();
- result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResulteData,
- op.getResults(), index, simulate, cache));
+ result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResultData,
+ op.getResults(), index, true, cache));
} else {
op = manager.createRebalanceFactory().start();
// Wait until the rebalance is complete and then get the results
- result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResulteData,
- op.getResults(), index, simulate, cache));
+ result = ResultBuilder.buildResult(buildResultForRebalance(rebalanceResultData,
+ op.getResults(), index, false, cache));
}
}
index++;
@@ -297,9 +296,9 @@ public class DataCommands implements CommandMarker {
}
}
- List<String> tokenize(String str, String separator) {
+ private List<String> tokenize(String str, String separator) {
StringTokenizer st = new StringTokenizer(str, separator);
- List<String> rstList = new ArrayList<String>();
+ List<String> rstList = new ArrayList<>();
while (st.hasMoreTokens()) {
rstList.add(st.nextToken());
@@ -308,16 +307,15 @@ public class DataCommands implements CommandMarker {
return rstList;
}
- boolean checkResultList(CompositeResultData rebalanceResulteData, List resultList,
+ private boolean checkResultList(CompositeResultData rebalanceResultData, List resultList,
DistributedMember member) {
boolean toContinueForOtherMembers = false;
- if (resultList != null && !resultList.isEmpty()) {
- for (int i = 0; i < resultList.size(); i++) {
- Object object = resultList.get(i);
+ if (CollectionUtils.isNotEmpty(resultList)) {
+ for (Object object : resultList) {
if (object instanceof Exception) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()),
((Exception) object).getMessage());
@@ -327,7 +325,7 @@ public class DataCommands implements CommandMarker {
toContinueForOtherMembers = true;
break;
} else if (object instanceof Throwable) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(CliStrings.REBALANCE__MSG__NO_EXECUTION, member.getId()),
((Throwable) object).getMessage());
@@ -341,7 +339,7 @@ public class DataCommands implements CommandMarker {
} else {
LogWrapper.getInstance().info(
"Rebalancing for member=" + member.getId() + ", resultList is either null or empty");
- rebalanceResulteData.addSection().addData("Rebalancing for member=" + member.getId(),
+ rebalanceResultData.addSection().addData("Rebalancing for member=" + member.getId(),
", resultList is either null or empty");
toContinueForOtherMembers = true;
}
@@ -349,15 +347,14 @@ public class DataCommands implements CommandMarker {
return toContinueForOtherMembers;
}
- Result executeRebalanceOnDS(InternalCache cache, String simulate, String[] excludeRegionsList) {
+ private Result executeRebalanceOnDS(InternalCache cache, String simulate,
+ String[] excludeRegionsList) {
Result result = null;
int index = 1;
- CompositeResultData rebalanceResulteData = ResultBuilder.createCompositeResultData();
- List<String> listExcludedRegion = new ArrayList<String>();
+ CompositeResultData rebalanceResultData = ResultBuilder.createCompositeResultData();
+ List<String> listExcludedRegion = new ArrayList<>();
if (excludeRegionsList != null) {
- for (String str : excludeRegionsList) {
- listExcludedRegion.add(str);
- }
+ Collections.addAll(listExcludedRegion, excludeRegionsList);
}
List<MemberPRInfo> listMemberRegion = getMemberRegionList(cache, listExcludedRegion);
@@ -377,29 +374,26 @@ public class DataCommands implements CommandMarker {
}
}
- if (flagToContinueWithRebalance == false) {
+ if (!flagToContinueWithRebalance) {
return ResultBuilder
.createInfoResult(CliStrings.REBALANCE__MSG__NO_REBALANCING_REGIONS_ON_DS);
}
- Iterator<MemberPRInfo> it1 = listMemberRegion.iterator();
- while (it1.hasNext() && flagToContinueWithRebalance) {
+ for (MemberPRInfo memberPR : listMemberRegion) {
try {
- MemberPRInfo memberPR = (MemberPRInfo) it1.next();
- // check if there are more than one members associated with region for
- // rebalancing
+ // check if there are more than one members associated with region for rebalancing
if (memberPR.dsMemberList.size() > 1) {
for (int i = 0; i < memberPR.dsMemberList.size(); i++) {
DistributedMember dsMember = memberPR.dsMemberList.get(i);
Function rebalanceFunction = new RebalanceFunction();
Object[] functionArgs = new Object[3];
functionArgs[0] = simulate;
- Set<String> regionSet = new HashSet<String>();
+ Set<String> regionSet = new HashSet<>();
regionSet.add(memberPR.region);
functionArgs[1] = regionSet;
- Set<String> excludeRegionSet = new HashSet<String>();
+ Set<String> excludeRegionSet = new HashSet<>();
functionArgs[2] = excludeRegionSet;
List resultList = null;
@@ -409,52 +403,51 @@ public class DataCommands implements CommandMarker {
resultList = (ArrayList) CliUtil
.executeFunction(rebalanceFunction, functionArgs, dsMember).getResult();
- if (checkResultList(rebalanceResulteData, resultList, dsMember) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, dsMember)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate.equals("true") ? true : false, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, simulate.equals("true"), cache));
index++;
- // Rebalancing for region is done so break and continue with
- // other region
+ // Rebalancing for region is done so break and continue with other region
break;
} else {
if (i == memberPR.dsMemberList.size() - 1) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(
CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1,
memberPR.region, listOfAllMembers(memberPR.dsMemberList)),
CliStrings.REBALANCE__MSG__MEMBERS_MIGHT_BE_DEPARTED);
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
} else {
continue;
}
}
} catch (Exception ex) {
if (i == memberPR.dsMemberList.size() - 1) {
- rebalanceResulteData.addSection().addData(
+ rebalanceResultData.addSection().addData(
CliStrings.format(
CliStrings.REBALANCE__MSG__NO_EXECUTION_FOR_REGION_0_ON_MEMBERS_1,
memberPR.region, listOfAllMembers(memberPR.dsMemberList)),
CliStrings.REBALANCE__MSG__REASON + ex.getMessage());
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ result = ResultBuilder.buildResult(rebalanceResultData);
} else {
continue;
}
}
- if (checkResultList(rebalanceResulteData, resultList, dsMember) == true) {
- result = ResultBuilder.buildResult(rebalanceResulteData);
+ if (checkResultList(rebalanceResultData, resultList, dsMember)) {
+ result = ResultBuilder.buildResult(rebalanceResultData);
continue;
}
List<String> rstList = tokenize((String) resultList.get(0), ",");
- result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResulteData,
- (ArrayList) rstList, index, simulate.equals("true") ? true : false, cache));
+ result = ResultBuilder.buildResult(toCompositeResultData(rebalanceResultData,
+ (ArrayList) rstList, index, simulate.equals("true"), cache));
index++;
}
}
@@ -487,65 +480,59 @@ public class DataCommands implements CommandMarker {
ArrayList<String> rstlist, int index, boolean simulate, InternalCache cache) {
// add only if there are any valid regions in results
- if (rstlist.size() > resultItemCount && rstlist.get(resultItemCount) != null
- && rstlist.get(resultItemCount).length() > 0) {
+ if (rstlist.size() > resultItemCount && StringUtils.isNotEmpty(rstlist.get(resultItemCount))) {
TabularResultData table1 = rebalanceResulteData.addSection().addTable("Table" + index);
String newLine = System.getProperty("line.separator");
StringBuilder resultStr = new StringBuilder();
resultStr.append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES);
table1.accumulate("Value", rstlist.get(0));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = " + rstlist.get(0));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES).append(" = ")
+ .append(rstlist.get(0)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM);
table1.accumulate("Value", rstlist.get(1));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = " + rstlist.get(1));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM).append(" = ")
+ .append(rstlist.get(1)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED);
table1.accumulate("Value", rstlist.get(2));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = " + rstlist.get(2));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED).append(" = ")
+ .append(rstlist.get(2)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES);
table1.accumulate("Value", rstlist.get(3));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = " + rstlist.get(3));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES).append(" = ")
+ .append(rstlist.get(3)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME);
table1.accumulate("Value", rstlist.get(4));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME + " = " + rstlist.get(4));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME).append(" = ")
+ .append(rstlist.get(4)).append(newLine);
table1.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED);
table1.accumulate("Value", rstlist.get(5));
- resultStr.append(
- CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED + " = " + rstlist.get(5));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED).append(" = ")
+ .append(rstlist.get(5)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME);
table1.accumulate("Value", rstlist.get(6));
- resultStr
- .append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME + " = " + rstlist.get(6));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME).append(" = ")
+ .append(rstlist.get(6)).append(newLine);
table1.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED);
table1.accumulate("Value", rstlist.get(7));
- resultStr.append(
- CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED + " = " + rstlist.get(7));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED).append(" = ")
+ .append(rstlist.get(7)).append(newLine);
table1.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALTIME);
table1.accumulate("Value", rstlist.get(8));
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME + " = " + rstlist.get(8));
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME).append(" = ").append(rstlist.get(8))
+ .append(newLine);
- String headerText = null;
+ String headerText;
if (simulate) {
headerText = "Simulated partition regions ";
} else {
@@ -560,81 +547,73 @@ public class DataCommands implements CommandMarker {
return rebalanceResulteData;
}
- CompositeResultData buildResultForRebalance(CompositeResultData rebalanceResulteData,
+ private CompositeResultData buildResultForRebalance(CompositeResultData rebalanceResultData,
RebalanceResults results, int index, boolean simulate, InternalCache cache) {
Set<PartitionRebalanceInfo> regions = results.getPartitionRebalanceDetails();
Iterator iterator = regions.iterator();
// add only if there are valid number of regions
- if (regions.size() > 0 && ((PartitionRebalanceInfo) iterator.next()).getRegionPath() != null
- && ((PartitionRebalanceInfo) iterator.next()).getRegionPath().length() > 0) {
+ if (regions.size() > 0
+ && StringUtils.isNotEmpty(((PartitionRebalanceInfo) iterator.next()).getRegionPath())) {
final TabularResultData resultData =
- rebalanceResulteData.addSection().addTable("Table" + index);
+ rebalanceResultData.addSection().addTable("Table" + index);
String newLine = System.getProperty("line.separator");
StringBuilder resultStr = new StringBuilder();
resultStr.append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES);
resultData.accumulate("Value", results.getTotalBucketCreateBytes());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES + " = "
- + results.getTotalBucketCreateBytes());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATEBYTES).append(" = ")
+ .append(results.getTotalBucketCreateBytes()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM);
resultData.accumulate("Value", results.getTotalBucketCreateTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM + " = "
- + results.getTotalBucketCreateTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATETIM).append(" = ")
+ .append(results.getTotalBucketCreateTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED);
resultData.accumulate("Value", results.getTotalBucketCreatesCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED + " = "
- + results.getTotalBucketCreatesCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETCREATESCOMPLETED).append(" = ")
+ .append(results.getTotalBucketCreatesCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES);
resultData.accumulate("Value", results.getTotalBucketTransferBytes());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES + " = "
- + results.getTotalBucketTransferBytes());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERBYTES).append(" = ")
+ .append(results.getTotalBucketTransferBytes()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME);
resultData.accumulate("Value", results.getTotalBucketTransferTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME + " = "
- + results.getTotalBucketTransferTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERTIME).append(" = ")
+ .append(results.getTotalBucketTransferTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED);
resultData.accumulate("Value", results.getTotalBucketTransfersCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED + " = "
- + results.getTotalBucketTransfersCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALBUCKETTRANSFERSCOMPLETED).append(" = ")
+ .append(results.getTotalBucketTransfersCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME);
resultData.accumulate("Value", results.getTotalPrimaryTransferTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME + " = "
- + results.getTotalPrimaryTransferTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERTIME).append(" = ")
+ .append(results.getTotalPrimaryTransferTime()).append(newLine);
resultData.accumulate("Rebalanced Stats",
CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED);
resultData.accumulate("Value", results.getTotalPrimaryTransfersCompleted());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED + " = "
- + results.getTotalPrimaryTransfersCompleted());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALPRIMARYTRANSFERSCOMPLETED).append(" = ")
+ .append(results.getTotalPrimaryTransfersCompleted()).append(newLine);
resultData.accumulate("Rebalanced Stats", CliStrings.REBALANCE__MSG__TOTALTIME);
resultData.accumulate("Value", results.getTotalTime());
- resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME + " = " + results.getTotalTime());
- resultStr.append(newLine);
+ resultStr.append(CliStrings.REBALANCE__MSG__TOTALTIME).append(" = ")
+ .append(results.getTotalTime()).append(newLine);
Iterator<PartitionRebalanceInfo> it = regions.iterator();
- String headerText = null;
+ String headerText;
if (simulate) {
headerText = "Simulated partition regions ";
@@ -650,7 +629,7 @@ public class DataCommands implements CommandMarker {
cache.getLogger().info(headerText + resultStr);
}
- return rebalanceResulteData;
+ return rebalanceResultData;
}
public DistributedMember getAssociatedMembers(String region, final InternalCache cache) {
@@ -660,7 +639,7 @@ public class DataCommands implements CommandMarker {
DistributedMember member = null;
if (bean == null) {
- return member;
+ return null;
}
String[] membersName = bean.getMembers();
@@ -670,7 +649,7 @@ public class DataCommands implements CommandMarker {
boolean matchFound = false;
if (membersName.length > 1) {
- while (it.hasNext() && matchFound == false) {
+ while (it.hasNext() && !matchFound) {
DistributedMember dsmember = (DistributedMember) it.next();
for (String memberName : membersName) {
if (MBeanJMXAdapter.getMemberNameOrId(dsmember).equals(memberName)) {
@@ -684,8 +663,9 @@ public class DataCommands implements CommandMarker {
return member;
}
- List<MemberPRInfo> getMemberRegionList(InternalCache cache, List<String> listExcludedRegion) {
- List<MemberPRInfo> listMemberPRInfo = new ArrayList<MemberPRInfo>();
+ private List<MemberPRInfo> getMemberRegionList(InternalCache cache,
+ List<String> listExcludedRegion) {
+ List<MemberPRInfo> listMemberPRInfo = new ArrayList<>();
String[] listDSRegions =
ManagementService.getManagementService(cache).getDistributedSystemMXBean().listRegions();
final Set<DistributedMember> dsMembers = CliUtil.getAllMembers(cache);
@@ -693,11 +673,10 @@ public class DataCommands implements CommandMarker {
for (String regionName : listDSRegions) {
// check for excluded regions
boolean excludedRegionMatch = false;
- Iterator<String> it = listExcludedRegion.iterator();
- while (it.hasNext()) {
+ for (String aListExcludedRegion : listExcludedRegion) {
// this is needed since region name may start with / or without it
// also
- String excludedRegion = it.next().trim();
+ String excludedRegion = aListExcludedRegion.trim();
if (regionName.startsWith("/")) {
if (!excludedRegion.startsWith("/")) {
excludedRegion = "/" + excludedRegion;
@@ -715,7 +694,7 @@ public class DataCommands implements CommandMarker {
}
}
- if (excludedRegionMatch == true) {
+ if (excludedRegionMatch) {
// ignore this region
continue;
}
@@ -773,7 +752,7 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionName);
final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
- Result result = null;
+ Result result;
if (!filePath.endsWith(CliStrings.GEODE_DATA_FILE_EXTENSION)) {
return ResultBuilder.createUserErrorResult(CliStrings
@@ -826,13 +805,12 @@ public class DataCommands implements CommandMarker {
unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
optionContext = ConverterHint.MEMBERIDNAME,
help = CliStrings.IMPORT_DATA__MEMBER__HELP) String memberNameOrId,
- @CliOption(key = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, mandatory = false,
- unspecifiedDefaultValue = "false",
+ @CliOption(key = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, unspecifiedDefaultValue = "false",
help = CliStrings.IMPORT_DATA__INVOKE_CALLBACKS__HELP) boolean invokeCallbacks) {
this.securityService.authorizeRegionWrite(regionName);
- Result result = null;
+ Result result;
try {
final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
@@ -874,8 +852,7 @@ public class DataCommands implements CommandMarker {
return result;
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.PUT}, help = CliStrings.PUT__HELP)
public Result put(
@CliOption(key = {CliStrings.PUT__KEY}, mandatory = true,
@@ -894,26 +871,28 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionWrite(regionPath);
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
- if (regionPath == null || regionPath.isEmpty()) {
+ DataCommandResult dataResult;
+ if (StringUtils.isEmpty(regionPath)) {
return makePresentationResult(DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createPutResult(key, null, null,
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createPutResult(key, null, null,
CliStrings.PUT__MSG__KEY_EMPTY, false));
+ }
- if (value == null || value.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createPutResult(value, null,
- null, CliStrings.PUT__MSG__VALUE_EMPTY, false));
+ if (StringUtils.isEmpty(value)) {
+ return makePresentationResult(DataCommandResult.createPutResult(value, null, null,
+ CliStrings.PUT__MSG__VALUE_EMPTY, false));
+ }
@SuppressWarnings("rawtypes")
Region region = cache.getRegion(regionPath);
DataCommandFunction putfn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.PUT);
request.setValue(value);
@@ -923,28 +902,30 @@ public class DataCommands implements CommandMarker {
request.setValueClass(valueClass);
request.setPutIfAbsent(putIfAbsent);
dataResult = callFunctionForRegion(request, putfn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createPutInfoResult(key, value, null,
CliStrings.format(CliStrings.PUT__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = putfn.put(key, value, putIfAbsent, keyClass, valueClass, regionPath);
}
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
private Result makePresentationResult(DataCommandResult dataResult) {
- if (dataResult != null)
+ if (dataResult != null) {
return dataResult.toCommandResult();
- else
+ } else {
return ResultBuilder.createGemFireErrorResult("Error executing data command");
+ }
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.GET}, help = CliStrings.GET__HELP)
public Result get(
@CliOption(key = {CliStrings.GET__KEY}, mandatory = true,
@@ -962,23 +943,24 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionPath, key);
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createGetResult(key, null, null,
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createGetResult(key, null, null,
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createGetResult(key, null, null,
CliStrings.GET__MSG__KEY_EMPTY, false));
+ }
@SuppressWarnings("rawtypes")
Region region = cache.getRegion(regionPath);
DataCommandFunction getfn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.GET);
request.setKey(key);
@@ -988,25 +970,26 @@ public class DataCommands implements CommandMarker {
request.setLoadOnCacheMiss(loadOnCacheMiss);
Subject subject = this.securityService.getSubject();
if (subject != null) {
- request.setPrincipal((Serializable) subject.getPrincipal());
+ request.setPrincipal(subject.getPrincipal());
}
dataResult = callFunctionForRegion(request, getfn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createGetInfoResult(key, null, null,
CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = getfn.get(null, key, keyClass, valueClass, regionPath, loadOnCacheMiss);
}
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.LOCATE_ENTRY}, help = CliStrings.LOCATE_ENTRY__HELP)
public Result locateEntry(
@CliOption(key = {CliStrings.LOCATE_ENTRY__KEY}, mandatory = true,
@@ -1024,20 +1007,21 @@ public class DataCommands implements CommandMarker {
this.securityService.authorizeRegionRead(regionPath, key);
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createLocateEntryResult(key,
- null, null, CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false));
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createLocateEntryResult(key, null, null,
+ CliStrings.LOCATE_ENTRY__MSG__REGIONNAME_EMPTY, false));
}
- if (key == null || key.isEmpty())
- return makePresentationResult(dataResult = DataCommandResult.createLocateEntryResult(key,
- null, null, CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false));
+ if (StringUtils.isEmpty(key)) {
+ return makePresentationResult(DataCommandResult.createLocateEntryResult(key, null, null,
+ CliStrings.LOCATE_ENTRY__MSG__KEY_EMPTY, false));
+ }
DataCommandFunction locateEntry = new DataCommandFunction();
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), true);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.LOCATE_ENTRY);
request.setKey(key);
@@ -1046,18 +1030,19 @@ public class DataCommands implements CommandMarker {
request.setValueClass(valueClass);
request.setRecursive(recursive);
dataResult = callFunctionForRegion(request, locateEntry, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createLocateEntryInfoResult(key, null, null, CliStrings.format(
CliStrings.LOCATE_ENTRY__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath), false);
+ }
dataResult.setKeyClass(keyClass);
- if (valueClass != null)
+ if (valueClass != null) {
dataResult.setValueClass(valueClass);
+ }
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@CliCommand(value = {CliStrings.REMOVE}, help = CliStrings.REMOVE__HELP)
public Result remove(
@CliOption(key = {CliStrings.REMOVE__KEY}, help = CliStrings.REMOVE__KEY__HELP,
@@ -1070,16 +1055,16 @@ public class DataCommands implements CommandMarker {
@CliOption(key = {CliStrings.REMOVE__KEYCLASS},
help = CliStrings.REMOVE__KEYCLASS__HELP) String keyClass) {
InternalCache cache = getCache();
- DataCommandResult dataResult = null;
+ DataCommandResult dataResult;
- if (regionPath == null || regionPath.isEmpty()) {
- return makePresentationResult(dataResult = DataCommandResult.createRemoveResult(key, null,
- null, CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false));
+ if (StringUtils.isEmpty(regionPath)) {
+ return makePresentationResult(DataCommandResult.createRemoveResult(key, null, null,
+ CliStrings.REMOVE__MSG__REGIONNAME_EMPTY, false));
}
if (!removeAllKeys && (key == null)) {
- return makePresentationResult(dataResult = DataCommandResult.createRemoveResult(key, null,
- null, CliStrings.REMOVE__MSG__KEY_EMPTY, false));
+ return makePresentationResult(DataCommandResult.createRemoveResult(null, null, null,
+ CliStrings.REMOVE__MSG__KEY_EMPTY, false));
}
if (removeAllKeys) {
@@ -1093,7 +1078,7 @@ public class DataCommands implements CommandMarker {
DataCommandFunction removefn = new DataCommandFunction();
if (region == null) {
Set<DistributedMember> memberList = getRegionAssociatedMembers(regionPath, getCache(), false);
- if (memberList != null && memberList.size() > 0) {
+ if (CollectionUtils.isNotEmpty(memberList)) {
DataCommandRequest request = new DataCommandRequest();
request.setCommand(CliStrings.REMOVE);
request.setKey(key);
@@ -1101,10 +1086,11 @@ public class DataCommands implements CommandMarker {
request.setRemoveAllKeys(removeAllKeys ? "ALL" : null);
request.setRegionName(regionPath);
dataResult = callFunctionForRegion(request, removefn, memberList);
- } else
+ } else {
dataResult = DataCommandResult.createRemoveInfoResult(key, null, null,
CliStrings.format(CliStrings.REMOVE__MSG__REGION_NOT_FOUND_ON_ALL_MEMBERS, regionPath),
false);
+ }
} else {
dataResult = removefn.remove(key, keyClass, regionPath, removeAllKeys ? "ALL" : null);
@@ -1114,17 +1100,15 @@ public class DataCommands implements CommandMarker {
return makePresentationResult(dataResult);
}
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DATA, CliStrings.TOPIC_GEODE_REGION})
@MultiStepCommand
@CliCommand(value = {CliStrings.QUERY}, help = CliStrings.QUERY__HELP)
public Object query(
@CliOption(key = CliStrings.QUERY__QUERY, help = CliStrings.QUERY__QUERY__HELP,
mandatory = true) final String query,
- @CliOption(key = CliStrings.QUERY__STEPNAME, mandatory = false, help = "Step name",
+ @CliOption(key = CliStrings.QUERY__STEPNAME, help = "Step name",
unspecifiedDefaultValue = CliStrings.QUERY__STEPNAME__DEFAULTVALUE) String stepName,
- @CliOption(key = CliStrings.QUERY__INTERACTIVE, mandatory = false,
- help = CliStrings.QUERY__INTERACTIVE__HELP,
+ @CliOption(key = CliStrings.QUERY__INTERACTIVE, help = CliStrings.QUERY__INTERACTIVE__HELP,
unspecifiedDefaultValue = "true") final boolean interactive) {
if (!CliUtil.isGfshVM() && stepName.equals(CliStrings.QUERY__STEPNAME__DEFAULTVALUE)) {
@@ -1156,18 +1140,12 @@ public class DataCommands implements CommandMarker {
public String region;
public MemberPRInfo() {
- region = new String();
- dsMemberList = new ArrayList<DistributedMember>();
+ region = "";
+ dsMemberList = new ArrayList<>();
}
public boolean equals(Object o2) {
- if (o2 == null) {
- return false;
- }
- if (this.region.equals(((MemberPRInfo) o2).region)) {
- return true;
- }
- return false;
+ return o2 != null && this.region.equals(((MemberPRInfo) o2).region);
}
}
@@ -1196,8 +1174,7 @@ public class DataCommands implements CommandMarker {
FunctionService.onMembers(members).setArguments(request).execute(putfn);
List list = (List) collector.getResult();
DataCommandResult result = null;
- for (int i = 0; i < list.size(); i++) {
- Object object = list.get(i);
+ for (Object object : list) {
if (object instanceof Throwable) {
Throwable error = (Throwable) object;
result = new DataCommandResult();
@@ -1220,42 +1197,45 @@ public class DataCommands implements CommandMarker {
public static Set<DistributedMember> getQueryRegionsAssociatedMembers(Set<String> regions,
final InternalCache cache, boolean returnAll) {
LogWriter logger = cache.getLogger();
- Set<DistributedMember> members = null;
+ Set<DistributedMember> members;
Set<DistributedMember> newMembers = null;
Iterator<String> iterator = regions.iterator();
- String region = (String) iterator.next();
+ String region = iterator.next();
members = getRegionAssociatedMembers(region, cache, true);
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine("Members for region " + region + " Members " + members);
- List<String> regionAndingList = new ArrayList<String>();
+ }
+ List<String> regionAndingList = new ArrayList<>();
regionAndingList.add(region);
if (regions.size() == 1) {
newMembers = members;
} else {
- if (members != null && !members.isEmpty()) {
+ if (CollectionUtils.isNotEmpty(members)) {
while (iterator.hasNext()) {
region = iterator.next();
newMembers = getRegionAssociatedMembers(region, cache, true);
if (newMembers == null) {
- newMembers = new HashSet<DistributedMember>();
+ newMembers = new HashSet<>();
}
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine("Members for region " + region + " Members " + newMembers);
+ }
regionAndingList.add(region);
newMembers.retainAll(members);
members = newMembers;
- if (logger.fineEnabled())
+ if (logger.fineEnabled()) {
logger.fine(
"Members after anding for regions " + regionAndingList + " List : " + newMembers);
+ }
}
}
}
- members = new HashSet<DistributedMember>();
- if (newMembers == null)
+ members = new HashSet<>();
+ if (newMembers == null) {
return members;
- Iterator<DistributedMember> memberIterator = newMembers.iterator();
- while (memberIterator.hasNext()) {
- members.add(memberIterator.next());
+ }
+ for (DistributedMember newMember : newMembers) {
+ members.add(newMember);
if (!returnAll) {
return members;
}
@@ -1267,17 +1247,20 @@ public class DataCommands implements CommandMarker {
public static Set<DistributedMember> getRegionAssociatedMembers(String region,
final InternalCache cache, boolean returnAll) {
- DistributedMember member = null;
+ DistributedMember member;
- if (region == null || region.isEmpty())
+ if (StringUtils.isEmpty(region)) {
return null;
+ }
DistributedRegionMXBean bean =
ManagementService.getManagementService(cache).getDistributedRegionMXBean(region);
- if (bean == null)// try with slash ahead
+ if (bean == null) {
+ // try with slash ahead
bean = ManagementService.getManagementService(cache)
.getDistributedRegionMXBean(Region.SEPARATOR + region);
+ }
if (bean == null) {
return null;
@@ -1285,11 +1268,11 @@ public class DataCommands implements CommandMarker {
String[] membersName = bean.getMembers();
Set<DistributedMember> dsMembers = cache.getMembers();
- Set<DistributedMember> dsMembersWithThisMember = new HashSet<DistributedMember>();
+ Set<DistributedMember> dsMembersWithThisMember = new HashSet<>();
dsMembersWithThisMember.addAll(dsMembers);
dsMembersWithThisMember.add(cache.getDistributedSystem().getDistributedMember());
Iterator it = dsMembersWithThisMember.iterator();
- Set<DistributedMember> matchedMembers = new HashSet<DistributedMember>();
+ Set<DistributedMember> matchedMembers = new HashSet<>();
if (membersName.length > 0) {
while (it.hasNext()) {
@@ -1321,11 +1304,13 @@ public class DataCommands implements CommandMarker {
int replacedVars = 0;
while (!done) {
int index1 = query.indexOf("${", startIndex);
- if (index1 == -1)
+ if (index1 == -1) {
break;
+ }
int index2 = query.indexOf("}", index1);
- if (index2 == -1)
+ if (index2 == -1) {
break;
+ }
String var = query.substring(index1 + 2, index2);
String value = gfshEnvVarMap.get(var);
if (value != null) {
@@ -1333,8 +1318,9 @@ public class DataCommands implements CommandMarker {
replacedVars++;
}
startIndex = index2 + 1;
- if (startIndex >= query.length())
+ if (startIndex >= query.length()) {
done = true;
+ }
}
return new Object[] {replacedVars, query};
}
http://git-wip-us.apache.org/repos/asf/geode/blob/9af854aa/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
index 423d781..fe88fc9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DataCommandResult.java
@@ -17,14 +17,7 @@ package org.apache.geode.management.internal.cli.domain;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.createBannerResult;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.createPageResult;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.DataSerializer;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.management.cli.Result;
@@ -38,20 +31,28 @@ import org.apache.geode.management.internal.cli.result.CompositeResultData.Secti
import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
import org.apache.geode.management.internal.cli.util.JsonUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
/**
- * Domain object used for Data Commands Functions
- *
- * TODO : Implement DataSerializable
- *
+ * Domain object used for Data Commands Functions TODO : Implement DataSerializable
*/
public class DataCommandResult implements /* Data */ Serializable {
- /**
- *
- */
+ private static Logger logger = LogManager.getLogger();
+
private static final long serialVersionUID = 1L;
private String command;
private Object putResult;
@@ -66,7 +67,9 @@ public class DataCommandResult implements /* Data */ Serializable {
public static final String RESULT_FLAG = "Result";
public static final String NUM_ROWS = "Rows";
- // Aggreagated Data.
+ public static final String MISSING_VALUE = "<NULL>";
+
+ // Aggregated Data.
private List<KeyInfo> locateEntryLocations;
private KeyInfo locateEntryResult;
private boolean hasResultForAggregation;
@@ -91,21 +94,24 @@ public class DataCommandResult implements /* Data */ Serializable {
if (isGet()) {
sb.append(" Type : Get").append(NEW_LINE);
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (getResult != null)
+ if (getResult != null) {
sb.append(" ReturnValue Class : ").append(getResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(getResult).append(NEW_LINE);
} else if (isPut()) {
sb.append(" Type : Put");
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (putResult != null)
+ if (putResult != null) {
sb.append(" ReturnValue Class : ").append(putResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(putResult).append(NEW_LINE);
sb.append(" Value : ").append(inputValue).append(NEW_LINE);
} else if (isRemove()) {
sb.append(" Type : Remove");
sb.append(" Key : ").append(inputKey).append(NEW_LINE);
- if (removeResult != null)
+ if (removeResult != null) {
sb.append(" ReturnValue Class : ").append(removeResult.getClass()).append(NEW_LINE);
+ }
sb.append(" ReturnValue : ").append(removeResult).append(NEW_LINE);
} else if (isLocateEntry()) {
sb.append(" Type : Locate Entry");
@@ -114,45 +120,31 @@ public class DataCommandResult implements /* Data */ Serializable {
sb.append(" Results : ").append(locateEntryResult).append(NEW_LINE);
sb.append(" Locations : ").append(locateEntryLocations).append(NEW_LINE);
}
- if (errorString != null)
+ if (errorString != null) {
sb.append(" ERROR ").append(errorString);
+ }
return sb.toString();
}
public boolean isGet() {
- if (CliStrings.GET.equals(command))
- return true;
- else
- return false;
+ return CliStrings.GET.equals(command);
}
public boolean isPut() {
- if (CliStrings.PUT.equals(command))
- return true;
- else
- return false;
+ return CliStrings.PUT.equals(command);
}
public boolean isRemove() {
- if (CliStrings.REMOVE.equals(command))
- return true;
- else
- return false;
+ return CliStrings.REMOVE.equals(command);
}
public boolean isLocateEntry() {
- if (CliStrings.LOCATE_ENTRY.equals(command))
- return true;
- else
- return false;
+ return CliStrings.LOCATE_ENTRY.equals(command);
}
public boolean isSelect() {
- if (CliStrings.QUERY.equals(command))
- return true;
- else
- return false;
+ return CliStrings.QUERY.equals(command);
}
public List<SelectResultRow> getSelectResult() {
@@ -393,11 +385,13 @@ public class DataCommandResult implements /* Data */ Serializable {
public Result toCommandResult() {
- if (keyClass == null || keyClass.isEmpty())
+ if (StringUtils.isEmpty(keyClass)) {
keyClass = "java.lang.String";
+ }
- if (valueClass == null || valueClass.isEmpty())
+ if (StringUtils.isEmpty(valueClass)) {
valueClass = "java.lang.String";
+ }
if (errorString != null) {
// return ResultBuilder.createGemFireErrorResult(errorString);
@@ -406,124 +400,140 @@ public class DataCommandResult implements /* Data */ Serializable {
section.addData("Message", errorString);
section.addData(RESULT_FLAG, operationCompletedSuccessfully);
return ResultBuilder.buildResult(data);
+ }
+
+ CompositeResultData data = ResultBuilder.createCompositeResultData();
+ SectionResultData section = data.addSection();
+ TabularResultData table = section.addTable();
+
+ section.addData(RESULT_FLAG, operationCompletedSuccessfully);
+ if (infoString != null) {
+ section.addData("Message", infoString);
+ }
+
+ if (isGet()) {
+ toCommandResult_isGet(section, table);
+ } else if (isLocateEntry()) {
+ toCommandResult_isLocate(section, table);
+ } else if (isPut()) {
+ toCommandResult_isPut(section, table);
+ } else if (isRemove()) {
+ toCommandResult_isRemove(section, table);
+ } else if (isSelect()) {
+ // its moved to its separate method
+ }
+ return ResultBuilder.buildResult(data);
+ }
+
+ private void toCommandResult_isGet(SectionResultData section, TabularResultData table) {
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
} else {
- CompositeResultData data = ResultBuilder.createCompositeResultData();
- SectionResultData section = data.addSection();
- TabularResultData table = section.addTable();
+ section.addData("Key", inputKey);
+ }
- section.addData(RESULT_FLAG, operationCompletedSuccessfully);
- if (infoString != null)
- section.addData("Message", infoString);
+ section.addData("Value Class", getValueClass());
+ if (!isDeclaredPrimitive(valueClass)) {
+ addJSONStringToTable(table, getResult);
+ } else {
+ section.addData("Value", getResult);
+ }
+ }
- if (isGet()) {
-
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
-
- section.addData("Value Class", getValueClass());
- if (!isDeclaredPrimitive(valueClass))
- addJSONStringToTable(table, getResult);
- else
- section.addData("Value", getResult);
-
-
- } else if (isLocateEntry()) {
-
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
-
- if (locateEntryLocations != null) {
- TabularResultData locationTable = section.addTable();
-
- int totalLocations = 0;
-
- for (KeyInfo info : locateEntryLocations) {
- List<Object[]> locations = info.getLocations();
-
- if (locations != null) {
- if (locations.size() == 1) {
- Object array[] = locations.get(0);
- // String regionPath = (String)array[0];
- boolean found = (Boolean) array[1];
- if (found) {
- totalLocations++;
- boolean primary = (Boolean) array[3];
- String bucketId = (String) array[4];
- locationTable.accumulate("MemberName", info.getMemberName());
- locationTable.accumulate("MemberId", info.getMemberId());
- if (bucketId != null) {// PR
- if (primary)
- locationTable.accumulate("Primary", "*Primary PR*");
- else
- locationTable.accumulate("Primary", "No");
- locationTable.accumulate("BucketId", bucketId);
- }
+ private void toCommandResult_isLocate(SectionResultData section, TabularResultData table) {
+
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
+ }
+
+ if (locateEntryLocations != null) {
+ TabularResultData locationTable = section.addTable();
+
+ int totalLocations = 0;
+
+ for (KeyInfo info : locateEntryLocations) {
+ List<Object[]> locations = info.getLocations();
+
+ if (locations != null) {
+ if (locations.size() == 1) {
+ Object array[] = locations.get(0);
+ // String regionPath = (String)array[0];
+ boolean found = (Boolean) array[1];
+ if (found) {
+ totalLocations++;
+ boolean primary = (Boolean) array[3];
+ String bucketId = (String) array[4];
+ locationTable.accumulate("MemberName", info.getMemberName());
+ locationTable.accumulate("MemberId", info.getMemberId());
+ if (bucketId != null) {// PR
+ if (primary) {
+ locationTable.accumulate("Primary", "*Primary PR*");
+ } else {
+ locationTable.accumulate("Primary", "No");
}
- } else {
- for (Object[] array : locations) {
- String regionPath = (String) array[0];
- boolean found = (Boolean) array[1];
- if (found) {
- totalLocations++;
- boolean primary = (Boolean) array[3];
- String bucketId = (String) array[4];
- locationTable.accumulate("MemberName", info.getMemberName());
- locationTable.accumulate("MemberId", info.getMemberId());
- locationTable.accumulate("RegionPath", regionPath);
- if (bucketId != null) {// PR
- if (primary)
- locationTable.accumulate("Primary", "*Primary PR*");
- else
- locationTable.accumulate("Primary", "No");
- locationTable.accumulate("BucketId", bucketId);
- }
+ locationTable.accumulate("BucketId", bucketId);
+ }
+ }
+ } else {
+ for (Object[] array : locations) {
+ String regionPath = (String) array[0];
+ boolean found = (Boolean) array[1];
+ if (found) {
+ totalLocations++;
+ boolean primary = (Boolean) array[3];
+ String bucketId = (String) array[4];
+ locationTable.accumulate("MemberName", info.getMemberName());
+ locationTable.accumulate("MemberId", info.getMemberId());
+ locationTable.accumulate("RegionPath", regionPath);
+ if (bucketId != null) {// PR
+ if (primary) {
+ locationTable.accumulate("Primary", "*Primary PR*");
+ } else {
+ locationTable.accumulate("Primary", "No");
}
+ locationTable.accumulate("BucketId", bucketId);
}
}
}
}
- section.addData("Locations Found", totalLocations);
- } else {
- section.addData("Location Info ", "Could not find location information");
}
+ }
+ section.addData("Locations Found", totalLocations);
+ } else {
+ section.addData("Location Info ", "Could not find location information");
+ }
+ }
- } else if (isPut()) {
- section.addData("Key Class", getKeyClass());
-
- if (!isDeclaredPrimitive(keyClass)) {
- addJSONStringToTable(table, inputKey);
- } else
- section.addData("Key", inputKey);
-
- section.addData("Value Class", getValueClass());
- if (!isDeclaredPrimitive(valueClass)) {
- addJSONStringToTable(table, putResult);
- } else
- section.addData("Old Value", putResult);
-
- } else if (isRemove()) {
- if (inputKey != null) {// avoids printing key when remove ALL is called
- section.addData("Key Class", getKeyClass());
- if (!isDeclaredPrimitive(keyClass))
- addJSONStringToTable(table, inputKey);
- else
- section.addData("Key", inputKey);
- }
- /*
- * if(valueClass!=null && !valueClass.isEmpty()){ section.addData("Value Class",
- * getValueClass()); addJSONStringToTable(table,removeResult); }else
- * section.addData("Value", removeResult);
- */
- } else if (isSelect()) {
- // its moved to its separate method
+ private void toCommandResult_isPut(SectionResultData section, TabularResultData table) {
+ section.addData("Key Class", getKeyClass());
+
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
+ }
+
+ section.addData("Value Class", getValueClass());
+ if (!isDeclaredPrimitive(valueClass)) {
+ addJSONStringToTable(table, putResult);
+ } else {
+ section.addData("Old Value", putResult);
+ }
+
+ }
+
+ private void toCommandResult_isRemove(SectionResultData section, TabularResultData table) {
+ if (inputKey != null) {// avoids printing key when remove ALL is called
+ section.addData("Key Class", getKeyClass());
+ if (!isDeclaredPrimitive(keyClass)) {
+ addJSONStringToTable(table, inputKey);
+ } else {
+ section.addData("Key", inputKey);
}
- return ResultBuilder.buildResult(data);
}
}
@@ -555,8 +565,9 @@ public class DataCommandResult implements /* Data */ Serializable {
}
if (this.selectResult != null) {
section.addData(NUM_ROWS, this.selectResult.size());
- if (this.queryTraceString != null)
+ if (this.queryTraceString != null) {
section.addData("Query Trace", this.queryTraceString);
+ }
buildTable(table, 0, selectResult.size());
}
}
@@ -570,7 +581,7 @@ public class DataCommandResult implements /* Data */ Serializable {
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public Result pageResult(int startCount, int endCount, String step) {
- List<String> fields = new ArrayList<String>();
+ List<String> fields = new ArrayList<>();
List values = new ArrayList<String>();
fields.add(RESULT_FLAG);
values.add(operationCompletedSuccessfully);
@@ -592,8 +603,8 @@ public class DataCommandResult implements /* Data */ Serializable {
if (selectResult != null) {
try {
TabularResultData table = ResultBuilder.createTabularResultData();
- String[] headers = null;
- Object[][] rows = null;
+ String[] headers;
+ Object[][] rows;
int rowCount = buildTable(table, startCount, endCount);
GfJsonArray array = table.getHeaders();
headers = new String[array.size()];
@@ -619,36 +630,70 @@ public class DataCommandResult implements /* Data */ Serializable {
Object valuesArray[] = {startCount, endCount};
return createPageResult(fieldsArray, valuesArray, step, headers, rows);
}
- } else
+ } else {
return createBannerResult(fields, values, step);
+ }
}
}
private int buildTable(TabularResultData table, int startCount, int endCount) {
- int rowCount = 0;
- // Introspect first using tabular data
- for (int i = startCount; i <= endCount; i++) {
- if (i >= selectResult.size())
- break;
- else
- rowCount++;
-
- SelectResultRow row = selectResult.get(i);
- switch (row.type) {
- case ROW_TYPE_BEAN:
- addJSONStringToTable(table, row.value);
- break;
- case ROW_TYPE_STRUCT_RESULT:
- addJSONStringToTable(table, row.value);
- break;
- case ROW_TYPE_PRIMITIVE:
- table.accumulate(RESULT_FLAG, row.value);
- break;
+ // Three steps:
+ // 1a. Convert each row object to a Json object.
+ // 1b. Build a list of keys that are used for each object
+ // 2. Pad MISSING_VALUE into Json objects for those data that are missing any particular key
+ // 3. Build the table from these Json objects.
+
+ // 1.
+ int lastRowExclusive = Math.min(selectResult.size(), endCount + 1);
+ List<SelectResultRow> paginatedRows = selectResult.subList(startCount, lastRowExclusive);
+
+ List<GfJsonObject> tableRows = new ArrayList<>();
+ List<GfJsonObject> rowsWithRealJsonObjects = new ArrayList<>();
+ Set<String> columns = new HashSet<>();
+
+ for (SelectResultRow row : paginatedRows) {
+ GfJsonObject object = new GfJsonObject();
+ try {
+ if (row.value == null || MISSING_VALUE.equals(row.value)) {
+ object.put("Value", MISSING_VALUE);
+ } else if (row.type == ROW_TYPE_PRIMITIVE) {
+ object.put(RESULT_FLAG, row.value);
+ } else {
+ object = buildGfJsonFromRawObject(row.value);
+ rowsWithRealJsonObjects.add(object);
+ object.keys().forEachRemaining(columns::add);
+ }
+ tableRows.add(object);
+ } catch (GfJsonException e) {
+ JSONObject errJson =
+ new JSONObject().put("Value", "Error getting bean properties " + e.getMessage());
+ tableRows.add(new GfJsonObject(errJson, false));
}
}
- return rowCount;
+
+ // 2.
+ for (GfJsonObject tableRow : rowsWithRealJsonObjects) {
+ for (String key : columns) {
+ if (!tableRow.has(key)) {
+ try {
+ tableRow.put(key, MISSING_VALUE);
+ } catch (GfJsonException e) {
+ // TODO: Address this unlikely possibility.
+ logger.warn("Ignored GfJsonException:", e);
+ }
+ }
+ }
+ }
+
+ // 3.
+ for (GfJsonObject jsonObject : tableRows) {
+ addJSONObjectToTable(table, jsonObject);
+ }
+
+ return paginatedRows.size();
}
+
private boolean isDeclaredPrimitive(String keyClass2) {
try {
Class klass = ClassPathLoader.getLatest().forName(keyClass2);
@@ -658,45 +703,6 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
- private void addJSONStringToTable(TabularResultData table, Object object) {
- if (object == null || "<NULL>".equals(object)) {
- table.accumulate("Value", "<NULL>");
- } else {
- try {
- Class klass = object.getClass();
- GfJsonObject jsonObject = null;
- if (String.class.equals(klass)) {
- // InputString in JSON Form but with round brackets
- String json = (String) object;
- String newString = json.replaceAll("'", "\"");
- if (newString.charAt(0) == '(') {
- int len = newString.length();
- StringBuilder sb = new StringBuilder();
- sb.append("{").append(newString.substring(1, len - 1)).append("}");
- newString = sb.toString();
- }
- jsonObject = new GfJsonObject(newString);
- } else {
- jsonObject = new GfJsonObject(object, true);
- }
-
- Iterator<String> keys = jsonObject.keys();
- while (keys.hasNext()) {
- String k = keys.next();
- // filter out meta-field type-class used to identify java class of json obbject
- if (!"type-class".equals(k)) {
- Object value = jsonObject.get(k);
- if (value != null) {
- table.accumulate(k, getDomainValue(value));
- }
- }
- }
- } catch (Exception e) {
- table.accumulate("Value", "Error getting bean properties " + e.getMessage());
- }
- }
- }
-
private Object getDomainValue(Object value) {
if (value instanceof String) {
@@ -708,8 +714,9 @@ public class DataCommandResult implements /* Data */ Serializable {
} catch (Exception e) {
return str;
}
- } else
+ } else {
return str;
+ }
}
return value;
}
@@ -722,7 +729,6 @@ public class DataCommandResult implements /* Data */ Serializable {
this.inputQuery = inputQuery;
}
-
public static class KeyInfo implements /* Data */ Serializable {
private String memberId;
@@ -734,8 +740,9 @@ public class DataCommandResult implements /* Data */ Serializable {
private ArrayList<Object[]> locations = null;
public void addLocation(Object[] locationArray) {
- if (this.locations == null)
- locations = new ArrayList<Object[]>();
+ if (this.locations == null) {
+ locations = new ArrayList<>();
+ }
locations.add(locationArray);
}
@@ -790,13 +797,14 @@ public class DataCommandResult implements /* Data */ Serializable {
}
public boolean hasLocation() {
- if (locations == null)
+ if (locations == null) {
return false;
- else {
+ } else {
for (Object[] array : locations) {
boolean found = (Boolean) array[1];
- if (found)
+ if (found) {
return true;
+ }
}
}
return false;
@@ -823,7 +831,6 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
-
public static final int ROW_TYPE_STRUCT_RESULT = 100;
public static final int ROW_TYPE_BEAN = 200;
public static final int ROW_TYPE_PRIMITIVE = 300;
@@ -856,45 +863,98 @@ public class DataCommandResult implements /* Data */ Serializable {
}
+
public void aggregate(DataCommandResult result) {
- if (isLocateEntry()) {
- /* Right now only called for LocateEntry */
+ /* Right now only called for LocateEntry */
+ if (!isLocateEntry()) {
+ return;
+ }
- if (this.locateEntryLocations == null) {
- locateEntryLocations = new ArrayList<KeyInfo>();
- }
+ if (this.locateEntryLocations == null) {
+ locateEntryLocations = new ArrayList<>();
+ }
- if (result == null) {// self-transform result from single to aggregate when numMember==1
- if (this.locateEntryResult != null) {
- locateEntryLocations.add(locateEntryResult);
- // TODO : Decide whether to show value or not this.getResult =
- // locateEntryResult.getValue();
- }
- return;
+ if (result == null) {// self-transform result from single to aggregate when numMember==1
+ if (this.locateEntryResult != null) {
+ locateEntryLocations.add(locateEntryResult);
+ // TODO : Decide whether to show value or not this.getResult = locateEntryResult.getValue();
}
+ return;
+ }
+
+ if (result.errorString != null && !result.errorString.equals(errorString)) {
+ // append errorString only if differs
+ errorString = result.errorString + " " + errorString;
+ }
+
+ // append message only when it differs for negative results
+ if (!operationCompletedSuccessfully && result.infoString != null
+ && !result.infoString.equals(infoString)) {
+ infoString = result.infoString;
+ }
- if (result.errorString != null && !result.errorString.equals(errorString)) {
- // append errorString only if differs
- String newString = result.errorString + " " + errorString;
- errorString = newString;
+ if (result.hasResultForAggregation) {
+ this.operationCompletedSuccessfully = true;
+ infoString = result.infoString;
+ if (result.locateEntryResult != null) {
+ locateEntryLocations.add(result.locateEntryResult);
}
+ }
+ }
- // append messsage only when it differs for negative results
- if (!operationCompletedSuccessfully && result.infoString != null
- && !result.infoString.equals(infoString)) {
- infoString = result.infoString;
+
+ private void addJSONObjectToTable(TabularResultData table, GfJsonObject object) {
+ Iterator<String> keys;
+
+ keys = object.keys();
+ while (keys.hasNext()) {
+ String k = keys.next();
+ // filter out meta-field type-class used to identify java class of json object
+ if (!"type-class".equals(k)) {
+ Object value = object.get(k);
+
+ if (value != null) {
+ table.accumulate(k, getDomainValue(value));
+ }
}
+ }
+ }
+
+ private GfJsonObject buildGfJsonFromRawObject(Object object) throws GfJsonException {
+ GfJsonObject jsonObject;
+ if (String.class.equals(object.getClass())) {
+ jsonObject = new GfJsonObject(sanitizeJsonString((String) object));
+ } else {
+ jsonObject = new GfJsonObject(object, true);
+ }
+
+ return jsonObject;
+ }
+
+ private String sanitizeJsonString(String s) {
+ // InputString in JSON Form but with round brackets
+ String newString = s.replaceAll("'", "\"");
+ if (newString.charAt(0) == '(') {
+ int len = newString.length();
+ newString = "{" + newString.substring(1, len - 1) + "}";
+ }
+ return newString;
+ }
- if (result.hasResultForAggregation /* && result.errorString==null */) {
- this.operationCompletedSuccessfully = true;// override this
- // result.operationCompletedSuccessfully
- infoString = result.infoString;
- if (result.locateEntryResult != null)
- locateEntryLocations.add(result.locateEntryResult);
+ private void addJSONStringToTable(TabularResultData table, Object object) {
+ if (object == null || MISSING_VALUE.equals(object)) {
+ table.accumulate("Value", MISSING_VALUE);
+ } else {
+ try {
+ GfJsonObject jsonObject = buildGfJsonFromRawObject(object);
+ addJSONObjectToTable(table, jsonObject);
+ } catch (Exception e) {
+ table.accumulate("Value", "Error getting bean properties " + e.getMessage());
}
}
}
+
// @Override
public void toData(DataOutput out) throws IOException {
DataSerializer.writeString(command, out);
@@ -935,5 +995,3 @@ public class DataCommandResult implements /* Data */ Serializable {
}
}
-
-
[19/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RollbackCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RollbackCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RollbackCommand.java
index a579170..cd12ea7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RollbackCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RollbackCommand.java
@@ -39,18 +39,18 @@ public class RollbackCommand extends BaseCommand {
private RollbackCommand() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- TXManagerImpl txMgr = (TXManagerImpl) servConn.getCache().getCacheTransactionManager();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
InternalDistributedMember client =
- (InternalDistributedMember) servConn.getProxyID().getDistributedMember();
- int uniqId = msg.getTransactionId();
+ (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember();
+ int uniqId = clientMessage.getTransactionId();
TXId txId = new TXId(client, uniqId);
if (txMgr.isHostedTxRecentlyCompleted(txId)) {
if (logger.isDebugEnabled()) {
logger.debug("TX: found a recently rolled back tx: {}", txId);
- sendRollbackReply(msg, servConn);
+ sendRollbackReply(clientMessage, serverConnection);
txMgr.removeHostedTXState(txId);
return;
}
@@ -60,16 +60,16 @@ public class RollbackCommand extends BaseCommand {
if (txState != null) {
txId = txState.getTxId();
txMgr.rollback();
- sendRollbackReply(msg, servConn);
+ sendRollbackReply(clientMessage, serverConnection);
} else {
// could not find TxState in the host server.
// Protect against a failover command received so late,
// and it is removed from the failoverMap due to capacity.
- sendRollbackReply(msg, servConn);
+ sendRollbackReply(clientMessage, serverConnection);
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} finally {
if (logger.isDebugEnabled()) {
logger.debug("TX: removing tx state for {}", txId);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Size.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Size.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Size.java
index c78f4d9..42e14a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Size.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Size.java
@@ -56,18 +56,18 @@ public class Size extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
StringBuilder errMessage = new StringBuilder();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadSizeRequestTime(start - oldStart);
// Retrieve the data from the message parts
- Part regionNamePart = msg.getPart(0);
+ Part regionNamePart = clientMessage.getPart(0);
String regionName = regionNamePart.getString();
if (regionName == null) {
@@ -76,8 +76,8 @@ public class Size extends BaseCommand {
errMessage
.append(LocalizedStrings.BaseCommand__THE_INPUT_REGION_NAME_FOR_THE_0_REQUEST_IS_NULL
.toLocalizedString("size"));
- writeErrorResponse(msg, MessageType.SIZE_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.SIZE_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -85,38 +85,38 @@ public class Size extends BaseCommand {
if (region == null) {
String reason = LocalizedStrings.BaseCommand__0_WAS_NOT_FOUND_DURING_1_REQUEST
.toLocalizedString(regionName, "size");
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Size the entry
try {
this.securityService.authorizeRegionRead(regionName);
- writeSizeResponse(region.size(), msg, servConn);
+ writeSizeResponse(region.size(), clientMessage, serverConnection);
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
+ writeException(clientMessage, rde, false, serverConnection);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If an exception occurs during the destroy, preserve the connection
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
if (e instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), e);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
}
} finally {
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent size response for region {}", servConn.getName(), regionName);
+ logger.debug("{}: Sent size response for region {}", serverConnection.getName(), regionName);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
stats.incWriteSizeResponseTime(DistributionStats.getStatTime() - start);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXFailoverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXFailoverCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXFailoverCommand.java
index 72eab50..9fc3fd1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXFailoverCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXFailoverCommand.java
@@ -49,23 +49,23 @@ public class TXFailoverCommand extends BaseCommand {
private TXFailoverCommand() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// Build the TXId for the transaction
InternalDistributedMember client =
- (InternalDistributedMember) servConn.getProxyID().getDistributedMember();
- int uniqId = msg.getTransactionId();
+ (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember();
+ int uniqId = clientMessage.getTransactionId();
if (logger.isDebugEnabled()) {
logger.debug("TX: Transaction {} from {} is failing over to this server", uniqId, client);
}
TXId txId = new TXId(client, uniqId);
- TXManagerImpl mgr = (TXManagerImpl) servConn.getCache().getCacheTransactionManager();
+ TXManagerImpl mgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
mgr.waitForCompletingTransaction(txId); // in case it's already completing here in another
// thread
if (mgr.isHostedTxRecentlyCompleted(txId)) {
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
mgr.removeHostedTXState(txId);
return;
}
@@ -75,7 +75,7 @@ public class TXFailoverCommand extends BaseCommand {
if (!tx.isRealDealLocal()) {
// send message to all peers to find out who hosts the transaction
FindRemoteTXMessageReplyProcessor processor =
- FindRemoteTXMessage.send(servConn.getCache(), txId);
+ FindRemoteTXMessage.send(serverConnection.getCache(), txId);
try {
processor.waitForRepliesUninterruptibly();
} catch (ReplyException e) {
@@ -96,7 +96,7 @@ public class TXFailoverCommand extends BaseCommand {
// bug #42228 and bug #43504 - this cannot return until the current view
// has been installed by all members, so that dlocks are released and
// the same keys can be used in a new transaction by the same client thread
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
try {
WaitForViewInstallation.send((DistributionManager) cache.getDistributionManager());
} catch (InterruptedException e) {
@@ -110,9 +110,9 @@ public class TXFailoverCommand extends BaseCommand {
}
mgr.saveTXCommitMessageForClientFailover(txId, processor.getTxCommitMessage());
} else {
- writeException(msg, new TransactionDataNodeHasDepartedException(
- "Could not find transaction host for " + txId), false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, new TransactionDataNodeHasDepartedException(
+ "Could not find transaction host for " + txId), false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
mgr.removeHostedTXState(txId);
return;
}
@@ -121,8 +121,8 @@ public class TXFailoverCommand extends BaseCommand {
if (!wasInProgress) {
mgr.setInProgress(false);
}
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXSynchronizationCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXSynchronizationCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXSynchronizationCommand.java
index 8cedd2c..c5b9fc5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXSynchronizationCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/TXSynchronizationCommand.java
@@ -15,7 +15,6 @@
package org.apache.geode.internal.cache.tier.sockets.command;
-import org.apache.geode.cache.SynchronizationCommitConflictException;
import org.apache.geode.cache.client.internal.TXSynchronizationOp.CompletionType;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.ReplyException;
@@ -54,7 +53,7 @@ public class TXSynchronizationCommand extends BaseCommand {
* org.apache.geode.internal.cache.tier.sockets.ServerConnection)
*/
@Override
- protected boolean shouldMasqueradeForTx(Message msg, ServerConnection servConn) {
+ protected boolean shouldMasqueradeForTx(Message clientMessage, ServerConnection serverConnection) {
// masquerading is done in the waiting thread pool
return false;
}
@@ -68,26 +67,26 @@ public class TXSynchronizationCommand extends BaseCommand {
* long)
*/
@Override
- public void cmdExecute(final Message msg, final ServerConnection servConn, long start)
+ public void cmdExecute(final Message clientMessage, final ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
- CompletionType type = CompletionType.values()[msg.getPart(0).getInt()];
- /* int txIdInt = */ msg.getPart(1).getInt(); // [bruce] not sure if we need to transmit this
+ CompletionType type = CompletionType.values()[clientMessage.getPart(0).getInt()];
+ /* int txIdInt = */ clientMessage.getPart(1).getInt(); // [bruce] not sure if we need to transmit this
final Part statusPart;
if (type == CompletionType.AFTER_COMPLETION) {
- statusPart = msg.getPart(2);
+ statusPart = clientMessage.getPart(2);
} else {
statusPart = null;
}
- final TXManagerImpl txMgr = (TXManagerImpl) servConn.getCache().getCacheTransactionManager();
+ final TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
final InternalDistributedMember member =
- (InternalDistributedMember) servConn.getProxyID().getDistributedMember();
+ (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember();
// get the tx state without associating it with this thread. That's done later
- final TXStateProxy txProxy = txMgr.masqueradeAs(msg, member, true);
+ final TXStateProxy txProxy = txMgr.masqueradeAs(clientMessage, member, true);
// we have to run beforeCompletion and afterCompletion in the same thread
// because beforeCompletion obtains locks for the thread and afterCompletion
@@ -102,21 +101,21 @@ public class TXSynchronizationCommand extends BaseCommand {
TXStateProxy txState = null;
Throwable failureException = null;
try {
- txState = txMgr.masqueradeAs(msg, member, false);
+ txState = txMgr.masqueradeAs(clientMessage, member, false);
if (isDebugEnabled) {
logger.debug("Executing beforeCompletion() notification for transaction {}",
- msg.getTransactionId());
+ clientMessage.getTransactionId());
}
txState.setIsJTA(true);
txState.beforeCompletion();
try {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
} catch (IOException e) {
if (isDebugEnabled) {
logger.debug("Problem writing reply to client", e);
}
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
} catch (ReplyException e) {
failureException = e.getCause();
} catch (InterruptedException e) {
@@ -128,13 +127,13 @@ public class TXSynchronizationCommand extends BaseCommand {
}
if (failureException != null) {
try {
- writeException(msg, failureException, false, servConn);
+ writeException(clientMessage, failureException, false, serverConnection);
} catch (IOException ioe) {
if (isDebugEnabled) {
logger.debug("Problem writing reply to client", ioe);
}
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
}
};
@@ -150,11 +149,11 @@ public class TXSynchronizationCommand extends BaseCommand {
public void run() {
TXStateProxy txState = null;
try {
- txState = txMgr.masqueradeAs(msg, member, false);
+ txState = txMgr.masqueradeAs(clientMessage, member, false);
int status = statusPart.getInt();
if (isDebugEnabled) {
logger.debug("Executing afterCompletion({}) notification for transaction {}",
- status, msg.getTransactionId());
+ status, clientMessage.getTransactionId());
}
txState.setIsJTA(true);
txState.afterCompletion(status);
@@ -162,7 +161,7 @@ public class TXSynchronizationCommand extends BaseCommand {
// where it can be applied to the local cache
TXCommitMessage cmsg = txState.getCommitMessage();
try {
- CommitCommand.writeCommitResponse(cmsg, msg, servConn);
+ CommitCommand.writeCommitResponse(cmsg, clientMessage, serverConnection);
txMgr.removeHostedTXState(txState.getTxId());
} catch (IOException e) {
// not much can be done here
@@ -170,16 +169,16 @@ public class TXSynchronizationCommand extends BaseCommand {
logger.warn("Problem writing reply to client", e);
}
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
} catch (RuntimeException e) {
try {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
} catch (IOException ioe) {
if (isDebugEnabled) {
logger.debug("Problem writing reply to client", ioe);
}
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
@@ -195,12 +194,12 @@ public class TXSynchronizationCommand extends BaseCommand {
sync.runSecondRunnable(afterCompletion);
} else {
if (statusPart.getInt() == Status.STATUS_COMMITTED) {
- TXStateProxy txState = txMgr.masqueradeAs(msg, member, false);
+ TXStateProxy txState = txMgr.masqueradeAs(clientMessage, member, false);
try {
if (isDebugEnabled) {
logger.debug(
"Executing beforeCompletion() notification for transaction {} after failover",
- msg.getTransactionId());
+ clientMessage.getTransactionId());
}
txState.setIsJTA(true);
txState.beforeCompletion();
@@ -212,8 +211,8 @@ public class TXSynchronizationCommand extends BaseCommand {
}
}
} catch (Exception e) {
- writeException(msg, MessageType.EXCEPTION, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, MessageType.EXCEPTION, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
if (isDebugEnabled) {
logger.debug("Sent tx synchronization response");
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterest.java
index 7dbb78f..597f92b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterest.java
@@ -45,43 +45,43 @@ public class UnregisterInterest extends BaseCommand {
UnregisterInterest() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws ClassNotFoundException, IOException {
Part regionNamePart = null, keyPart = null;
String regionName = null;
Object key = null;
int interestType = 0;
StringId errMessage = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
- regionNamePart = msg.getPart(0);
- interestType = msg.getPart(1).getInt();
- keyPart = msg.getPart(2);
- Part isClosingPart = msg.getPart(3);
+ regionNamePart = clientMessage.getPart(0);
+ interestType = clientMessage.getPart(1).getInt();
+ keyPart = clientMessage.getPart(2);
+ Part isClosingPart = clientMessage.getPart(3);
byte[] isClosingPartBytes = (byte[]) isClosingPart.getObject();
boolean isClosing = isClosingPartBytes[0] == 0x01;
regionName = regionNamePart.getString();
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean keepalive = false;
try {
- Part keepalivePart = msg.getPart(4);
+ Part keepalivePart = clientMessage.getPart(4);
byte[] keepaliveBytes = (byte[]) keepalivePart.getObject();
keepalive = keepaliveBytes[0] != 0x00;
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received unregister interest request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// Process the unregister interest request
@@ -95,9 +95,9 @@ public class UnregisterInterest extends BaseCommand {
errMessage =
LocalizedStrings.UnRegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_UNREGISTER_INTEREST_REQUEST_IS_NULL;
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeErrorResponse(msg, MessageType.UNREGISTER_INTEREST_DATA_ERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeErrorResponse(clientMessage, MessageType.UNREGISTER_INTEREST_DATA_ERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -108,12 +108,12 @@ public class UnregisterInterest extends BaseCommand {
this.securityService.authorizeRegionRead(regionName, key.toString());
}
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
try {
@@ -121,8 +121,8 @@ public class UnregisterInterest extends BaseCommand {
authzRequest.unregisterInterestAuthorize(regionName, key, interestType);
key = unregisterContext.getKey();
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -141,17 +141,17 @@ public class UnregisterInterest extends BaseCommand {
*/
// Unregister interest irrelevent of whether the region is present it or
// not
- servConn.getAcceptor().getCacheClientNotifier().unregisterClientInterest(regionName, key,
- interestType, isClosing, servConn.getProxyID(), keepalive);
+ serverConnection.getAcceptor().getCacheClientNotifier().unregisterClientInterest(regionName, key,
+ interestType, isClosing, serverConnection.getProxyID(), keepalive);
// Update the statistics and write the reply
// bserverStats.incLong(processDestroyTimeId,
// DistributionStats.getStatTime() - start);
// start = DistributionStats.getStatTime();
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent unregister interest response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent unregister interest response for region {} key {}", serverConnection.getName(),
regionName, key);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestList.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestList.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestList.java
index 7369587..76cbba2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestList.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UnregisterInterestList.java
@@ -46,48 +46,48 @@ public class UnregisterInterestList extends BaseCommand {
private UnregisterInterestList() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
Part regionNamePart = null, keyPart = null, numberOfKeysPart = null;
String regionName = null;
Object key = null;
List keys = null;
int numberOfKeys = 0, partNumber = 0;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
- Part isClosingListPart = msg.getPart(1);
+ Part isClosingListPart = clientMessage.getPart(1);
byte[] isClosingListPartBytes = (byte[]) isClosingListPart.getObject();
boolean isClosingList = isClosingListPartBytes[0] == 0x01;
boolean keepalive = false;
try {
- Part keepalivePart = msg.getPart(2);
+ Part keepalivePart = clientMessage.getPart(2);
byte[] keepalivePartBytes = (byte[]) keepalivePart.getObject();
keepalive = keepalivePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- numberOfKeysPart = msg.getPart(3);
+ numberOfKeysPart = clientMessage.getPart(3);
numberOfKeys = numberOfKeysPart.getInt();
partNumber = 4;
keys = new ArrayList();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(partNumber + i);
+ keyPart = clientMessage.getPart(partNumber + i);
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
keys.add(key);
@@ -95,7 +95,7 @@ public class UnregisterInterestList extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received unregister interest request ({} bytes) from {} for the following {} keys in region {}: {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), numberOfKeys,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), numberOfKeys,
regionName, keys);
}
@@ -113,22 +113,22 @@ public class UnregisterInterestList extends BaseCommand {
LocalizedStrings.UnRegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_UNREGISTER_INTEREST_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeErrorResponse(msg, MessageType.UNREGISTER_INTEREST_DATA_ERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeErrorResponse(clientMessage, MessageType.UNREGISTER_INTEREST_DATA_ERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
this.securityService.authorizeRegionRead(regionName);
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
try {
@@ -136,8 +136,8 @@ public class UnregisterInterestList extends BaseCommand {
authzRequest.unregisterInterestListAuthorize(regionName, keys);
keys = (List) unregisterContext.getKey();
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -155,20 +155,20 @@ public class UnregisterInterestList extends BaseCommand {
* responded = true; } else {
*/
// Register interest
- servConn.getAcceptor().getCacheClientNotifier().unregisterClientInterest(regionName, keys,
- isClosingList, servConn.getProxyID(), keepalive);
+ serverConnection.getAcceptor().getCacheClientNotifier().unregisterClientInterest(regionName, keys,
+ isClosingList, serverConnection.getProxyID(), keepalive);
// Update the statistics and write the reply
// bserverStats.incLong(processDestroyTimeId,
// DistributionStats.getStatTime() - start);
// start = DistributionStats.getStatTime(); WHY ARE GETTING START AND NOT
// USING IT?
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sent unregister interest response for the following {} keys in region {}: {}",
- servConn.getName(), numberOfKeys, regionName, keys);
+ serverConnection.getName(), numberOfKeys, regionName, keys);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
// DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UpdateClientNotification.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UpdateClientNotification.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UpdateClientNotification.java
index 57aca22..b870a96 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UpdateClientNotification.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/UpdateClientNotification.java
@@ -35,8 +35,8 @@ public class UpdateClientNotification extends BaseCommand {
private UpdateClientNotification() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CacheServerStats stats = servConn.getCacheServerStats();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CacheServerStats stats = serverConnection.getCacheServerStats();
{
long oldStart = start;
start = DistributionStats.getStatTime();
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
index ac9b5da..72719b2 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseCQ.java
@@ -44,30 +44,30 @@ public class CloseCQ extends BaseCQCommand {
private CloseCQ() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- ClientProxyMembershipID id = servConn.getProxyID();
- CacheServerStats stats = servConn.getCacheServerStats();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ ClientProxyMembershipID id = serverConnection.getProxyID();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// Based on MessageType.QUERY
// Added by Rao 2/1/2007
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- String cqName = msg.getPart(0).getString();
+ String cqName = clientMessage.getPart(0).getString();
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received close CQ request from {} cqName: {}", servConn.getName(),
- servConn.getSocketString(), cqName);
+ logger.debug("{}: Received close CQ request from {} cqName: {}", serverConnection.getName(),
+ serverConnection.getSocketString(), cqName);
}
// Process the query request
if (cqName == null) {
String err =
LocalizedStrings.CloseCQ_THE_CQNAME_FOR_THE_CQ_CLOSE_REQUEST_IS_NULL.toLocalizedString();
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null, servConn);
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
@@ -85,7 +85,7 @@ public class CloseCQ extends BaseCQCommand {
}
InternalCqQuery cqQuery = cqService.getCq(serverCqName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
String queryStr = null;
Set cqRegionNames = null;
@@ -102,22 +102,22 @@ public class CloseCQ extends BaseCQCommand {
// getMembershipID());
cqService.closeCq(cqName, id);
if (cqQuery != null)
- servConn.removeCq(cqName, cqQuery.isDurable());
+ serverConnection.removeCq(cqName, cqQuery.isDurable());
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
String err =
LocalizedStrings.CloseCQ_EXCEPTION_WHILE_CLOSING_CQ_CQNAME_0.toLocalizedString(cqName);
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, msg.getTransactionId(), e, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e, serverConnection);
return;
}
// Send OK to client
sendCqResponse(MessageType.REPLY,
- LocalizedStrings.CloseCQ_CQ_CLOSED_SUCCESSFULLY.toLocalizedString(), msg.getTransactionId(),
- null, servConn);
- servConn.setAsTrue(RESPONDED);
+ LocalizedStrings.CloseCQ_CQ_CLOSED_SUCCESSFULLY.toLocalizedString(), clientMessage.getTransactionId(),
+ null, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
{
long oldStart = start;
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
index 9bddbc7..d2a4453 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ.java
@@ -52,27 +52,27 @@ public class ExecuteCQ extends BaseCQCommand {
private ExecuteCQ() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
- AcceptorImpl acceptor = servConn.getAcceptor();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- ClientProxyMembershipID id = servConn.getProxyID();
- CacheServerStats stats = servConn.getCacheServerStats();
+ AcceptorImpl acceptor = serverConnection.getAcceptor();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ ClientProxyMembershipID id = serverConnection.getProxyID();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the data from the message parts
- String cqName = msg.getPart(0).getString();
- String cqQueryString = msg.getPart(1).getString();
- int cqState = msg.getPart(2).getInt();
+ String cqName = clientMessage.getPart(0).getString();
+ String cqQueryString = clientMessage.getPart(1).getString();
+ int cqState = clientMessage.getPart(2).getInt();
- Part isDurablePart = msg.getPart(3);
+ Part isDurablePart = clientMessage.getPart(3);
byte[] isDurableByte = isDurablePart.getSerializedForm();
boolean isDurable = (isDurableByte == null || isDurableByte[0] == 0) ? false : true;
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received {} request from {} CqName: {} queryString: {}", servConn.getName(),
- MessageType.getString(msg.getMessageType()), servConn.getSocketString(), cqName,
+ logger.debug("{}: Received {} request from {} CqName: {} queryString: {}", serverConnection.getName(),
+ MessageType.getString(clientMessage.getMessageType()), serverConnection.getSocketString(), cqName,
cqQueryString);
}
@@ -87,7 +87,7 @@ public class ExecuteCQ extends BaseCQCommand {
qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
// Authorization check
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
query = qService.newQuery(cqQueryString);
cqRegionNames = ((DefaultQuery) query).getRegionsInQuery(null);
@@ -108,10 +108,10 @@ public class ExecuteCQ extends BaseCQCommand {
cqQuery = cqServiceForExec.executeCq(cqName, cqQueryString, cqState, id,
acceptor.getCacheClientNotifier(), isDurable, false, 0, null);
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
+ writeChunkedException(clientMessage, e, serverConnection);
return;
}
@@ -119,7 +119,7 @@ public class ExecuteCQ extends BaseCQCommand {
boolean sendResults = false;
boolean successQuery = false;
- if (msg.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
+ if (clientMessage.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
sendResults = true;
}
@@ -130,8 +130,8 @@ public class ExecuteCQ extends BaseCQCommand {
cqRegionNames = ((DefaultQuery) query).getRegionsInQuery(null);
}
((DefaultQuery) query).setIsCqQuery(true);
- successQuery = processQuery(msg, query, cqQueryString, cqRegionNames, start, cqQuery,
- executeCQContext, servConn, sendResults);
+ successQuery = processQuery(clientMessage, query, cqQueryString, cqRegionNames, start, cqQuery,
+ executeCQContext, serverConnection, sendResults);
// Update the CQ statistics.
cqQuery.getVsdStats().setCqInitialResultsTime((DistributionStats.getStatTime()) - oldstart);
@@ -153,12 +153,12 @@ public class ExecuteCQ extends BaseCQCommand {
// Send OK to client
sendCqResponse(MessageType.REPLY,
LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
- msg.getTransactionId(), null, servConn);
+ clientMessage.getTransactionId(), null, serverConnection);
long start2 = DistributionStats.getStatTime();
stats.incProcessCreateCqTime(start2 - oldstart);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
index de61445..805ee48 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteCQ61.java
@@ -60,30 +60,30 @@ public class ExecuteCQ61 extends BaseCQCommand {
private ExecuteCQ61() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
- AcceptorImpl acceptor = servConn.getAcceptor();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- ClientProxyMembershipID id = servConn.getProxyID();
- CacheServerStats stats = servConn.getCacheServerStats();
+ AcceptorImpl acceptor = serverConnection.getAcceptor();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ ClientProxyMembershipID id = serverConnection.getProxyID();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the data from the message parts
- String cqName = msg.getPart(0).getString();
- String cqQueryString = msg.getPart(1).getString();
- int cqState = msg.getPart(2).getInt();
+ String cqName = clientMessage.getPart(0).getString();
+ String cqQueryString = clientMessage.getPart(1).getString();
+ int cqState = clientMessage.getPart(2).getInt();
- Part isDurablePart = msg.getPart(3);
+ Part isDurablePart = clientMessage.getPart(3);
byte[] isDurableByte = isDurablePart.getSerializedForm();
boolean isDurable = (isDurableByte == null || isDurableByte[0] == 0) ? false : true;
// region data policy
- Part regionDataPolicyPart = msg.getPart(msg.getNumberOfParts() - 1);
+ Part regionDataPolicyPart = clientMessage.getPart(clientMessage.getNumberOfParts() - 1);
byte[] regionDataPolicyPartBytes = regionDataPolicyPart.getSerializedForm();
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received {} request from {} CqName: {} queryString: {}", servConn.getName(),
- MessageType.getString(msg.getMessageType()), servConn.getSocketString(), cqName,
+ logger.debug("{}: Received {} request from {} CqName: {} queryString: {}", serverConnection.getName(),
+ MessageType.getString(clientMessage.getMessageType()), serverConnection.getSocketString(), cqName,
cqQueryString);
}
@@ -96,8 +96,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
String err =
LocalizedStrings.ExecuteCQ_SERVER_NOTIFYBYSUBSCRIPTION_MODE_IS_SET_TO_FALSE_CQ_EXECUTION_IS_NOT_SUPPORTED_IN_THIS_MODE
.toLocalizedString();
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null,
- servConn);
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
}
@@ -113,7 +112,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
qService = (DefaultQueryService) crHelper.getCache().getLocalQueryService();
// Authorization check
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
query = qService.newQuery(cqQueryString);
cqRegionNames = ((DefaultQuery) query).getRegionsInQuery(null);
@@ -141,16 +140,16 @@ public class ExecuteCQ61 extends BaseCQCommand {
// registering cq with serverConnection so that when CCP will require auth info it can access
// that
// registering cq auth before as possibility that you may get event
- servConn.setCq(cqName, isDurable);
+ serverConnection.setCq(cqName, isDurable);
cqQuery = (ServerCQImpl) cqServiceForExec.executeCq(cqName, cqQueryString, cqState, id, ccn,
isDurable, true, regionDataPolicyPartBytes[0], null);
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
- servConn.removeCq(cqName, isDurable);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
+ serverConnection.removeCq(cqName, isDurable);
return;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.removeCq(cqName, isDurable);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.removeCq(cqName, isDurable);
return;
}
@@ -158,7 +157,7 @@ public class ExecuteCQ61 extends BaseCQCommand {
boolean sendResults = false;
boolean successQuery = false;
- if (msg.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
+ if (clientMessage.getMessageType() == MessageType.EXECUTECQ_WITH_IR_MSG_TYPE) {
sendResults = true;
}
@@ -173,8 +172,8 @@ public class ExecuteCQ61 extends BaseCQCommand {
cqRegionNames = ((DefaultQuery) query).getRegionsInQuery(null);
}
((DefaultQuery) query).setIsCqQuery(true);
- successQuery = processQuery(msg, query, cqQueryString, cqRegionNames, start, cqQuery,
- executeCQContext, servConn, sendResults);
+ successQuery = processQuery(clientMessage, query, cqQueryString, cqRegionNames, start, cqQuery,
+ executeCQContext, serverConnection, sendResults);
// Update the CQ statistics.
@@ -203,12 +202,12 @@ public class ExecuteCQ61 extends BaseCQCommand {
// Send OK to client
sendCqResponse(MessageType.REPLY,
LocalizedStrings.ExecuteCQ_CQ_CREATED_SUCCESSFULLY.toLocalizedString(),
- msg.getTransactionId(), null, servConn);
+ clientMessage.getTransactionId(), null, serverConnection);
long start2 = DistributionStats.getStatTime();
stats.incProcessCreateCqTime(start2 - oldstart);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
index 69be347..b1faeee 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetCQStats.java
@@ -36,32 +36,32 @@ public class GetCQStats extends BaseCQCommand {
private GetCQStats() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
- logger.debug("{}: Received close all client CQs request from {}", servConn.getName(),
- servConn.getSocketString());
+ logger.debug("{}: Received close all client CQs request from {}", serverConnection.getName(),
+ serverConnection.getSocketString());
}
// Retrieve the data from the message parts
- String cqName = msg.getPart(0).getString();
+ String cqName = clientMessage.getPart(0).getString();
if (isDebugEnabled) {
- logger.debug("{}: Received close CQ request from {} cqName: {}", servConn.getName(),
- servConn.getSocketString(), cqName);
+ logger.debug("{}: Received close CQ request from {} cqName: {}", serverConnection.getName(),
+ serverConnection.getSocketString(), cqName);
}
// Process the query request
if (cqName == null) {
String err = "The cqName for the cq stats request is null";
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null, servConn);
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
@@ -74,13 +74,12 @@ public class GetCQStats extends BaseCQCommand {
cqService.start();
} catch (Exception e) {
String err = "Exception while Getting the CQ Statistics. ";
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, msg.getTransactionId(), e, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e, serverConnection);
return;
}
// Send OK to client
- sendCqResponse(MessageType.REPLY, "cq stats sent successfully.", msg.getTransactionId(), null,
- servConn);
- servConn.setAsTrue(RESPONDED);
+ sendCqResponse(MessageType.REPLY, "cq stats sent successfully.", clientMessage.getTransactionId(), null, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
{
long oldStart = start;
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
index a2d201d..e39c8e1 100755
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetDurableCQs.java
@@ -44,19 +44,19 @@ public class GetDurableCQs extends BaseCQCommand {
private GetDurableCQs() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
- AcceptorImpl acceptor = servConn.getAcceptor();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- ClientProxyMembershipID id = servConn.getProxyID();
- CacheServerStats stats = servConn.getCacheServerStats();
+ AcceptorImpl acceptor = serverConnection.getAcceptor();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ ClientProxyMembershipID id = serverConnection.getProxyID();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received {} request from {}", servConn.getName(),
- MessageType.getString(msg.getMessageType()), servConn.getSocketString());
+ logger.debug("{}: Received {} request from {}", serverConnection.getName(),
+ MessageType.getString(clientMessage.getMessageType()), serverConnection.getSocketString());
}
DefaultQueryService qService = null;
@@ -68,7 +68,7 @@ public class GetDurableCQs extends BaseCQCommand {
this.securityService.authorizeClusterRead();
// Authorization check
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
authzRequest.getDurableCQsAuthorize();
}
@@ -76,34 +76,34 @@ public class GetDurableCQs extends BaseCQCommand {
cqServiceForExec = qService.getCqService();
List<String> durableCqs = cqServiceForExec.getAllDurableClientCqs(id);
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
- List durableCqList = new ArrayList(maximumChunkSize);
+ List durableCqList = new ArrayList(MAXIMUM_CHUNK_SIZE);
final boolean isTraceEnabled = logger.isTraceEnabled();
for (Iterator it = durableCqs.iterator(); it.hasNext();) {
Object durableCqName = it.next();
durableCqList.add(durableCqName);
if (isTraceEnabled) {
- logger.trace("{}: getDurableCqsResponse <{}>; list size was {}", servConn.getName(),
+ logger.trace("{}: getDurableCqsResponse <{}>; list size was {}", serverConnection.getName(),
durableCqName, durableCqList.size());
}
- if (durableCqList.size() == maximumChunkSize) {
+ if (durableCqList.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
- sendDurableCqsResponseChunk(durableCqList, false, servConn);
+ sendDurableCqsResponseChunk(durableCqList, false, serverConnection);
durableCqList.clear();
}
}
// Send the last chunk even if the list is of zero size.
- sendDurableCqsResponseChunk(durableCqList, true, servConn);
+ sendDurableCqsResponseChunk(durableCqList, true, serverConnection);
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
+ writeChunkedException(clientMessage, e, serverConnection);
return;
}
}
@@ -114,7 +114,7 @@ public class GetDurableCQs extends BaseCQCommand {
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
+ chunkedResponseMsg.addObjPart(list, false);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(),
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
index a8fec9f..5393e81 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MonitorCQ.java
@@ -36,39 +36,38 @@ public class MonitorCQ extends BaseCQCommand {
private MonitorCQ() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
- int op = msg.getPart(0).getInt();
+ int op = clientMessage.getPart(0).getInt();
if (op < 1) {
// This should have been taken care at the client - remove?
String err = LocalizedStrings.MonitorCQ__0_THE_MONITORCQ_OPERATION_IS_INVALID
- .toLocalizedString(servConn.getName());
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null, servConn);
+ .toLocalizedString(serverConnection.getName());
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
String regionName = null;
- if (msg.getNumberOfParts() == 2) {
+ if (clientMessage.getNumberOfParts() == 2) {
// This will be enable/disable on region.
- regionName = msg.getPart(1).getString();
+ regionName = clientMessage.getPart(1).getString();
if (regionName == null) {
// This should have been taken care at the client - remove?
String err =
LocalizedStrings.MonitorCQ__0_A_NULL_REGION_NAME_WAS_PASSED_FOR_MONITORCQ_OPERATION
- .toLocalizedString(servConn.getName());
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null,
- servConn);
+ .toLocalizedString(serverConnection.getName());
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received MonitorCq request from {} op: {}{}", servConn.getName(),
- servConn.getSocketString(), op, (regionName != null) ? " RegionName: " + regionName : "");
+ logger.debug("{}: Received MonitorCq request from {} op: {}{}", serverConnection.getName(),
+ serverConnection.getSocketString(), op, (regionName != null) ? " RegionName: " + regionName : "");
}
this.securityService.authorizeClusterRead();
@@ -85,12 +84,12 @@ public class MonitorCQ extends BaseCQCommand {
throw new CqException(
LocalizedStrings.CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED.toLocalizedString());
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
String err = LocalizedStrings.MonitorCQ_EXCEPTION_WHILE_HANDLING_THE_MONITOR_REQUEST_OP_IS_0
.toLocalizedString(Integer.valueOf(op));
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, msg.getTransactionId(), e, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e, serverConnection);
return;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
index 94304d3..070cb04 100644
--- a/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
+++ b/geode-cq/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/StopCQ.java
@@ -44,30 +44,30 @@ public class StopCQ extends BaseCQCommand {
private StopCQ() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- ClientProxyMembershipID id = servConn.getProxyID();
- CacheServerStats stats = servConn.getCacheServerStats();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ ClientProxyMembershipID id = serverConnection.getProxyID();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// Based on MessageType.QUERY
// Added by Rao 2/1/2007
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- String cqName = msg.getPart(0).getString();
+ String cqName = clientMessage.getPart(0).getString();
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received stop CQ request from {} cqName: {}", servConn.getName(),
- servConn.getSocketString(), cqName);
+ logger.debug("{}: Received stop CQ request from {} cqName: {}", serverConnection.getName(),
+ serverConnection.getSocketString(), cqName);
}
// Process the query request
if (cqName == null) {
String err =
LocalizedStrings.StopCQ_THE_CQNAME_FOR_THE_CQ_STOP_REQUEST_IS_NULL.toLocalizedString();
- sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, msg.getTransactionId(), null, servConn);
+ sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
@@ -86,7 +86,7 @@ public class StopCQ extends BaseCQCommand {
this.securityService.authorizeDataManage();
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
String queryStr = null;
Set cqRegionNames = null;
@@ -100,23 +100,23 @@ public class StopCQ extends BaseCQCommand {
}
cqService.stopCq(cqName, id);
if (cqQuery != null)
- servConn.removeCq(cqName, cqQuery.isDurable());
+ serverConnection.removeCq(cqName, cqQuery.isDurable());
} catch (CqException cqe) {
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", msg.getTransactionId(), cqe, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
String err =
LocalizedStrings.StopCQ_EXCEPTION_WHILE_STOPPING_CQ_NAMED_0.toLocalizedString(cqName);
- sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, msg.getTransactionId(), e, servConn);
+ sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e, serverConnection);
return;
}
// Send OK to client
sendCqResponse(MessageType.REPLY,
- LocalizedStrings.StopCQ_CQ_STOPPED_SUCCESSFULLY.toLocalizedString(), msg.getTransactionId(),
- null, servConn);
+ LocalizedStrings.StopCQ_CQ_STOPPED_SUCCESSFULLY.toLocalizedString(), clientMessage.getTransactionId(),
+ null, serverConnection);
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
{
long oldStart = start;
[10/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
index dbdebea..5a81b6e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/LogWriterAppenderJUnitTest.java
@@ -65,7 +65,7 @@ public class LogWriterAppenderJUnitTest {
* when the configuration is changed the appender is still there.
*/
@Test
- public final void testAppenderToConfigHandling() throws IOException {
+ public void testAppenderToConfigHandling() throws IOException {
LogService.setBaseLogLevel(Level.TRACE);
final AppenderContext rootContext = LogService.getAppenderContext();
@@ -110,7 +110,7 @@ public class LogWriterAppenderJUnitTest {
* Verifies that writing to a Log4j logger will end up in the LogWriter's output.
*/
@Test
- public final void testLogOutput() throws IOException {
+ public void testLogOutput() throws IOException {
// Create the appender
final StringWriter stringWriter = new StringWriter();
final PureLogWriter logWriter =
@@ -178,7 +178,7 @@ public class LogWriterAppenderJUnitTest {
* Verifies that logging occurs at the levels set in the LogWriter
*/
@Test
- public final void testLogWriterLevels() throws IOException {
+ public void testLogWriterLevels() throws IOException {
final String loggerName = LogService.MAIN_LOGGER_NAME; // this.getClass().getName();
LogService.getLogger(); // Force logging to be initialized
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
new file mode 100644
index 0000000..84dc959
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/statistics/StatArchiveWriterTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.statistics;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class StatArchiveWriterTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ StatArchiveWriter mockStatArchiveWriter = mock(StatArchiveWriter.class);
+
+ when(mockStatArchiveWriter.bytesWritten()).thenReturn(1L);
+
+ mockStatArchiveWriter.close();
+
+ verify(mockStatArchiveWriter, times(1)).close();
+
+ assertThat(mockStatArchiveWriter.bytesWritten()).isEqualTo(1L);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
new file mode 100644
index 0000000..ca141b4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.tcp;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+@Category(UnitTest.class)
+public class ConnectionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Connection mockConnection = mock(Connection.class);
+ SocketChannel channel = null;
+ ByteBuffer buffer = null;
+ boolean forceAsync = true;
+ DistributionMessage mockDistributionMessage = mock(DistributionMessage.class);
+
+ mockConnection.nioWriteFully(channel, buffer, forceAsync, mockDistributionMessage);
+
+ verify(mockConnection, times(1)).nioWriteFully(channel, buffer, forceAsync,
+ mockDistributionMessage);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
new file mode 100644
index 0000000..2c23ddc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaFromTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.OpenTypeConverter.CompositeBuilderViaFrom;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import javax.management.openmbean.CompositeData;
+
+@Category(UnitTest.class)
+public class CompositeBuilderViaFromTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CompositeBuilderViaFrom mockCompositeBuilderViaFrom = mock(CompositeBuilderViaFrom.class);
+ CompositeData compositeData = null;
+ String[] itemNames = new String[1];
+ OpenTypeConverter[] converters = new OpenTypeConverter[1];
+ Object result = new Object();
+
+ when(mockCompositeBuilderViaFrom.fromCompositeData(eq(compositeData), eq(itemNames),
+ eq(converters))).thenReturn(result);
+
+ assertThat(mockCompositeBuilderViaFrom.fromCompositeData(compositeData, itemNames, converters))
+ .isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
new file mode 100644
index 0000000..8fea2b6
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/CompositeBuilderViaProxyTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.OpenTypeConverter.CompositeBuilderViaProxy;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import javax.management.openmbean.CompositeData;
+
+@Category(UnitTest.class)
+public class CompositeBuilderViaProxyTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CompositeBuilderViaProxy mockCompositeBuilderViaProxy = mock(CompositeBuilderViaProxy.class);
+ CompositeData compositeData = null;
+ String[] itemNames = new String[1];
+ OpenTypeConverter[] converters = new OpenTypeConverter[1];
+ Object result = new Object();
+
+ when(mockCompositeBuilderViaProxy.fromCompositeData(eq(compositeData), eq(itemNames),
+ eq(converters))).thenReturn(result);
+
+ assertThat(mockCompositeBuilderViaProxy.fromCompositeData(compositeData, itemNames, converters))
+ .isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
new file mode 100644
index 0000000..2dea75b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/IdentityConverterTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class IdentityConverterTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ IdentityConverter mockIdentityConverter = mock(IdentityConverter.class);
+ Object value = new Object();
+ Object result = new Object();
+
+ when(mockIdentityConverter.toNonNullOpenValue(value)).thenReturn(result);
+ assertThat(mockIdentityConverter.toNonNullOpenValue(value)).isSameAs(result);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
index f624ab4..b582e52 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CliCommandTestBase.java
@@ -197,7 +197,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
/**
* Destroy all of the components created for the default setup.
*/
- protected final void destroyDefaultSetup() {
+ protected void destroyDefaultSetup() {
if (this.shell != null) {
executeCommand(shell, "exit");
this.shell.terminate();
@@ -276,7 +276,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
*
* @return The default shell
*/
- protected synchronized final HeadlessGfsh getDefaultShell() {
+ protected synchronized HeadlessGfsh getDefaultShell() {
if (this.shell == null) {
this.shell = createShell();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
index 760d2c4..edec00a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandsDUnitTest.java
@@ -554,7 +554,7 @@ public class ConfigCommandsDUnitTest extends CliCommandTestBase {
});
}
- private final void deleteTestFiles() throws IOException {
+ private void deleteTestFiles() throws IOException {
this.managerConfigFile.delete();
this.managerPropsFile.delete();
this.vm1ConfigFile.delete();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
index 77a2453..0bfbefa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeInfoTest.java
@@ -17,8 +17,6 @@ package org.apache.geode.management.internal.cli.functions;
import static org.assertj.core.api.Assertions.*;
import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -30,18 +28,9 @@ import java.io.DataOutputStream;
@Category(UnitTest.class)
public class ExportedLogsSizeInfoTest {
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
@Test
- public final void testExportedLogsSizeInfoConstructor() {
+ public void testExportedLogsSizeInfoConstructor() {
ExportedLogsSizeInfo sizeDetail = new ExportedLogsSizeInfo(1L, 11L, 111L);
assertThat(sizeDetail).isNotNull();
assertThat(sizeDetail.getLogsSize()).isEqualTo(1L);
@@ -50,7 +39,7 @@ public class ExportedLogsSizeInfoTest {
}
@Test
- public final void testExportedLogsSizeInfoZeroArgConstructor() {
+ public void testExportedLogsSizeInfoZeroArgConstructor() {
ExportedLogsSizeInfo sizeDetail = new ExportedLogsSizeInfo();
assertThat(sizeDetail).isNotNull();
assertThat(sizeDetail.getLogsSize()).isEqualTo(0L);
@@ -99,7 +88,7 @@ public class ExportedLogsSizeInfoTest {
}
@Test
- public final void testClassInequality() {
+ public void testClassInequality() {
ExportedLogsSizeInfo sizeDeatai1 = new ExportedLogsSizeInfo(7L, 77L, 777L);
String sizeDetail2 = sizeDeatai1.toString();
assertThat(sizeDeatai1.equals(sizeDetail2)).isFalse();
@@ -119,7 +108,6 @@ public class ExportedLogsSizeInfoTest {
assertThat(sizeDetail1.hashCode()).isEqualTo(29791);
assertThat(sizeDetail2.hashCode()).isEqualTo(41095);
assertThat(sizeDetail3.hashCode()).isEqualTo(115495);
-
}
@Test
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
index ba436c5..0bd0ee9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ShowMissingDiskStoresFunctionJUnitTest.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.management.internal.cli.functions;
import static org.junit.Assert.*;
@@ -63,6 +62,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class ShowMissingDiskStoresFunctionJUnitTest {
+
private GemFireCacheImpl cache;
private GemFireCacheImpl oldCacheInstance;
private InternalDistributedSystem system;
@@ -81,9 +81,6 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- /**
- * @throws java.lang.Exception
- */
@Before
public void setUp() throws Exception {
cache = Fakes.cache();
@@ -100,9 +97,6 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
memberManager = mock(PersistentMemberManager.class);
}
- /**
- * @throws java.lang.Exception
- */
@After
public void tearDown() throws Exception {
GemFireCacheImpl.setInstanceForTests(oldCacheInstance);
@@ -122,21 +116,14 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#getCache()}.
- */
@Test
- public final void testGetCache() {
+ public void testGetCache() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
assertTrue(smdsFunc.getCache() instanceof Cache);
}
- /**
- * Test method for {@link ShowMissingDiskStoresFunction#execute(FunctionContext)}.
- */
@Test
- public final void testExecute() {
+ public void testExecute() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -152,12 +139,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNotNull(results);
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWithNullContextThrowsRuntimeException() {
+ public void testExecuteWithNullContextThrowsRuntimeException() {
expectedException.expect(RuntimeException.class);
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
@@ -170,7 +153,7 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
* {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
*/
@Test
- public final void testExecuteWithNullCacheInstanceHasEmptyResults() throws Throwable {
+ public void testExecuteWithNullCacheInstanceHasEmptyResults() throws Throwable {
TestSMDSFFunc1 testSMDSFunc = new TestSMDSFFunc1();
List<?> results = null;
@@ -181,12 +164,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNull(results.get(0));
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWithNullGFCIResultValueIsNull() throws Throwable {
+ public void testExecuteWithNullGFCIResultValueIsNull() throws Throwable {
TestSMDSFFunc2 testSMDSFunc = new TestSMDSFFunc2();
List<?> results = null;
@@ -200,12 +179,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNull(results.get(0));
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteWhenGFCIClosedResultValueIsNull() throws Throwable {
+ public void testExecuteWhenGFCIClosedResultValueIsNull() throws Throwable {
TestSMDSFFunc2 testSMDSFunc = new TestSMDSFFunc2();
List<?> results = null;
@@ -216,14 +191,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
assertNotNull(results);
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws UnknownHostException
- */
@Test
- public final void testExecuteReturnsMissingDiskStores() throws Throwable {
+ public void testExecuteReturnsMissingDiskStores() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -261,12 +230,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- */
@Test
- public final void testExecuteReturnsMissingColocatedRegions() throws Throwable {
+ public void testExecuteReturnsMissingColocatedRegions() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -300,14 +265,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws UnknownHostException
- */
@Test
- public final void testExecuteReturnsMissingStoresAndRegions() throws Throwable {
+ public void testExecuteReturnsMissingStoresAndRegions() throws Throwable {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
List<?> results = null;
@@ -372,14 +331,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
}
}
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#execute(org.apache.geode.cache.execute.FunctionContext)}.
- *
- * @throws Throwable
- */
@Test
- public final void testExecuteCatchesExceptions() throws Throwable {
+ public void testExecuteCatchesExceptions() throws Exception {
expectedException.expect(RuntimeException.class);
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
@@ -391,13 +344,8 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
fail("Failed to catch expected RuntimeException");
}
-
- /**
- * Test method for
- * {@link org.apache.geode.management.internal.cli.functions.ShowMissingDiskStoresFunction#getId()}.
- */
@Test
- public final void testGetId() {
+ public void testGetId() {
ShowMissingDiskStoresFunction smdsFunc = new ShowMissingDiskStoresFunction();
assertEquals(ShowMissingDiskStoresFunction.class.getName(), smdsFunc.getId());
}
@@ -406,9 +354,9 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
private final List<Object> results = new LinkedList<Object>();
- private Throwable t;
+ private Exception t;
- protected List<Object> getResults() throws Throwable {
+ protected List<Object> getResults() throws Exception {
if (t != null) {
throw t;
}
@@ -427,7 +375,7 @@ public class ShowMissingDiskStoresFunctionJUnitTest {
@Override
public void sendException(final Throwable t) {
- this.t = t;
+ this.t = (Exception) t;
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
new file mode 100644
index 0000000..c894594
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/json/TypedJsonTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.json;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.Writer;
+
+@Category(UnitTest.class)
+public class TypedJsonTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TypedJson mockTypedJson = mock(TypedJson.class);
+ Writer writer = null;
+ Object value = new Object();
+
+ mockTypedJson.writeVal(writer, value);
+
+ verify(mockTypedJson, times(1)).writeVal(writer, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
index 2731b95..8ee3e0f 100755
--- a/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/controllers/WanCommandsControllerJUnitTest.java
@@ -117,7 +117,7 @@ public class WanCommandsControllerJUnitTest {
.contains("--" + START_GATEWAYSENDER__ID + "=" + "");
}
- private static final Object[] getParametersWithGroupsAndMembers() {
+ private static Object[] getParametersWithGroupsAndMembers() {
return $(new Object[] {"sender1", new String[] {}, new String[] {}, false, false},
new Object[] {"sender2", new String[] {"group1"}, new String[] {}, true, false},
new Object[] {"sender3", new String[] {"group1", "group2"}, new String[] {}, true, false},
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
new file mode 100644
index 0000000..ff98b7e
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/domain/LinkTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.web.domain;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.net.URI;
+
+import org.apache.geode.management.internal.web.http.HttpMethod;
+
+@Category(UnitTest.class)
+public class LinkTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Link mockLink = mock(Link.class);
+ URI href = null;
+ HttpMethod method = HttpMethod.CONNECT;
+ String relation = "";
+
+ mockLink.setHref(href);
+ mockLink.setMethod(method);
+ mockLink.setRelation(relation);
+
+ verify(mockLink, times(1)).setHref(href);
+ verify(mockLink, times(1)).setMethod(method);
+ verify(mockLink, times(1)).setRelation(relation);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
new file mode 100644
index 0000000..4a5a0d4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/web/http/ClientHttpRequestTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.web.http;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ClientHttpRequestTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ClientHttpRequest mockClientHttpRequest = mock(ClientHttpRequest.class);
+ Link mockLink = mock(Link.class);
+
+ when(mockClientHttpRequest.getLink()).thenReturn(mockLink);
+
+ assertThat(mockClientHttpRequest.getLink()).isSameAs(mockLink);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
index 4e8a271..497f428 100644
--- a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableDUnitTest.java
@@ -433,7 +433,7 @@ public class PdxSerializableDUnitTest extends JUnit4CacheTestCase {
* add a listener and writer that will throw an exception when invoked if events are for internal
* regions
*/
- public final void addPoisonedTransactionListeners() {
+ public void addPoisonedTransactionListeners() {
MyTestTransactionListener listener = new MyTestTransactionListener();
getCache().getCacheTransactionManager().addListener(listener);
getCache().getCacheTransactionManager().setWriter(listener);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java b/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
new file mode 100644
index 0000000..2644741
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/redis/internal/executor/AbstractScanExecutorTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.redis.internal.executor;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.regex.Pattern;
+
+@Category(UnitTest.class)
+public class AbstractScanExecutorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractScanExecutor mockAbstractScanExecutor = mock(AbstractScanExecutor.class);
+ Pattern pattern = Pattern.compile(".");
+
+ when(mockAbstractScanExecutor.convertGlobToRegex(eq("pattern"))).thenReturn(pattern);
+
+ assertThat(mockAbstractScanExecutor.convertGlobToRegex("pattern")).isSameAs(pattern);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java b/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
index 244f4e5..9d3f721 100644
--- a/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/security/ClientAuthorizationTestCase.java
@@ -102,7 +102,7 @@ public abstract class ClientAuthorizationTestCase extends JUnit4DistributedTestC
postSetUpClientAuthorizationTestBase();
}
- private final void setUpClientAuthorizationTestBase() throws Exception {
+ private void setUpClientAuthorizationTestBase() throws Exception {
server1 = getHost(0).getVM(0);
server2 = getHost(0).getVM(1);
client1 = getHost(0).getVM(2);
@@ -110,7 +110,7 @@ public abstract class ClientAuthorizationTestCase extends JUnit4DistributedTestC
setUpIgnoredExceptions();
}
- private final void setUpIgnoredExceptions() {
+ private void setUpIgnoredExceptions() {
Set<String> serverExceptions = new HashSet<>();
serverExceptions.addAll(Arrays.asList(serverIgnoredExceptions()));
if (serverExceptions.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
index 9a3ce86..1b09a83 100644
--- a/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/DeltaClientAuthorizationDUnitTest.java
@@ -155,7 +155,7 @@ public class DeltaClientAuthorizationDUnitTest extends ClientAuthorizationTestCa
}
}
- private final void setUpDeltas() {
+ private void setUpDeltas() {
for (int i = 0; i < 8; i++) {
deltas[i] = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
index 4cc8442..dc4ffac 100644
--- a/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/DeltaClientPostAuthorizationDUnitTest.java
@@ -130,7 +130,7 @@ public class DeltaClientPostAuthorizationDUnitTest extends ClientAuthorizationTe
}
@Override
- protected final void executeOpBlock(final List<OperationWithAction> opBlock, final int port1,
+ protected void executeOpBlock(final List<OperationWithAction> opBlock, final int port1,
final int port2, final String authInit, final Properties extraAuthProps,
final Properties extraAuthzProps, final TestCredentialGenerator credentialGenerator,
final Random random) throws InterruptedException {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java b/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
index 13d68b5..3a61bfc 100755
--- a/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
+++ b/geode-core/src/test/java/org/apache/geode/security/generator/AuthzCredentialGenerator.java
@@ -373,7 +373,7 @@ public abstract class AuthzCredentialGenerator {
* @return the name of this class code.
*/
@Override
- public final String toString() {
+ public String toString() {
return this.name;
}
@@ -383,7 +383,7 @@ public abstract class AuthzCredentialGenerator {
* @return true if other object is same as this one.
*/
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -399,7 +399,7 @@ public abstract class AuthzCredentialGenerator {
*
* @return true if other {@code ClassCode} is same as this one.
*/
- public final boolean equals(final ClassCode opCode) {
+ public boolean equals(final ClassCode opCode) {
return opCode != null && opCode.ordinal == this.ordinal;
}
@@ -409,7 +409,7 @@ public abstract class AuthzCredentialGenerator {
* @return the ordinal of this {@code ClassCode}.
*/
@Override
- public final int hashCode() {
+ public int hashCode() {
return this.ordinal;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java b/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
index 8695451..0ab4252 100755
--- a/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
+++ b/geode-core/src/test/java/org/apache/geode/security/generator/CredentialGenerator.java
@@ -283,7 +283,7 @@ public abstract class CredentialGenerator {
* @return the name of this operation.
*/
@Override
- public final String toString() {
+ public String toString() {
return this.name;
}
@@ -293,7 +293,7 @@ public abstract class CredentialGenerator {
* @return true if other object is same as this one.
*/
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -309,7 +309,7 @@ public abstract class CredentialGenerator {
*
* @return true if other {@code ClassCode} is same as this one.
*/
- public final boolean equals(final ClassCode opCode) {
+ public boolean equals(final ClassCode opCode) {
return opCode != null && opCode.ordinal == this.ordinal;
}
@@ -319,7 +319,7 @@ public abstract class CredentialGenerator {
* @return the ordinal of this operation.
*/
@Override
- public final int hashCode() {
+ public int hashCode() {
return this.ordinal;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
index 42ccf38..45fb919 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/DUnitEnv.java
@@ -35,7 +35,7 @@ public abstract class DUnitEnv {
public static DUnitEnv instance = null;
- public static final DUnitEnv get() {
+ public static DUnitEnv get() {
if (instance == null) {
try {
// for tests that are still being migrated to the open-source
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java b/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
index 5b8e615..72b8190 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/DistributedTestUtils.java
@@ -122,7 +122,7 @@ public class DistributedTestUtils {
}
}
- public final static Properties getAllDistributedSystemProperties(final Properties properties) {
+ public static Properties getAllDistributedSystemProperties(final Properties properties) {
Properties dsProperties = DUnitEnv.get().getDistributedSystemProperties();
// our tests do not expect auto-reconnect to be on by default
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java b/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
index 20fbb5b..a2ff978 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/Wait.java
@@ -135,7 +135,7 @@ public class Wait {
*
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final void pause(final int milliseconds) {
+ public static void pause(final int milliseconds) {
if (milliseconds >= 1000 || logger.isDebugEnabled()) { // check for debug but log at info
logger.info("Pausing for {} ms...", milliseconds);
}
@@ -211,7 +211,7 @@ public class Wait {
* @return the last time stamp observed
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource) {
+ public static long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource) {
return waitForExpiryClockToChange(cacheTimeMillisSource,
cacheTimeMillisSource.cacheTimeMillis());
}
@@ -224,7 +224,7 @@ public class Wait {
* @return the last time stamp observed
* @deprecated Please use {@link org.awaitility.Awaitility} instead.
*/
- public static final long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource,
+ public static long waitForExpiryClockToChange(final LocalRegion cacheTimeMillisSource,
final long baseTime) {
long nowTime;
do {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java b/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
index 1d67dcd..4c7d7f2 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDUnitTest.java
@@ -44,7 +44,7 @@ public class OverridingGetPropertiesDisconnectsAllDUnitTest extends JUnit4Distri
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
return props;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java b/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
index 71040ef..ceb1586 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/FailOutputTestCase.java
@@ -20,7 +20,6 @@ import java.io.InputStreamReader;
/**
* Abstract test case for tests verifying that unexpected test output will cause expected failures.
- *
*/
public abstract class FailOutputTestCase extends GoldenTestCase implements ExecutableProcess {
@@ -38,7 +37,7 @@ public abstract class FailOutputTestCase extends GoldenTestCase implements Execu
abstract void outputProblemInProcess(String message);
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java b/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
index 2e9b8f9..e3374f4 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/PassJUnitTest.java
@@ -68,7 +68,7 @@ public class PassJUnitTest extends GoldenTestCase implements ExecutableProcess {
}
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java b/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
index 2d60c27..e88a11d 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/PassWithExpectedProblemTestCase.java
@@ -74,7 +74,7 @@ public abstract class PassWithExpectedProblemTestCase extends GoldenTestCase
}
@Override
- public final void executeInProcess() throws IOException {
+ public void executeInProcess() throws IOException {
outputLine("Begin " + name() + ".main");
outputLine("Press Enter to continue.");
new BufferedReader(new InputStreamReader(System.in)).readLine();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
index e979f72..5e8bdac 100755
--- a/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/internal/cache/ha/CQListGIIDUnitTest.java
@@ -225,7 +225,7 @@ public class CQListGIIDUnitTest extends JUnit4DistributedTestCase {
return Integer.valueOf(server1.getPort());
}
- public static final Region createRegion(String name, String rootName, RegionAttributes attrs)
+ public static Region createRegion(String name, String rootName, RegionAttributes attrs)
throws CacheException {
Region root = cache.getRegion(rootName);
if (root == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
index b80f5de..aa1b084 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneDUnitTest.java
@@ -66,7 +66,7 @@ public abstract class LuceneDUnitTest extends JUnit4CacheTestCase {
RegionTestableType.PARTITION_PERSISTENT, RegionTestableType.FIXED_PARTITION};
}
- protected final Object[] parameterCombiner(Object[] aValues, Object[] bValues) {
+ protected Object[] parameterCombiner(Object[] aValues, Object[] bValues) {
Object[] parameters = new Object[aValues.length * bValues.length];
for (int i = 0; i < aValues.length; i++) {
for (int j = 0; j < bValues.length; j++) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
index a16646e..b83ca44 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationDUnitTest.java
@@ -41,13 +41,13 @@ import static org.junit.Assert.*;
@RunWith(JUnitParamsRunner.class)
public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
- private final Object[] parametersForMultipleIndexCreates() {
+ private Object[] parametersForMultipleIndexCreates() {
Integer[] numIndexes = {1, 2, 10};
RegionTestableType[] regionTestTypes = getListOfRegionTestTypes();
return parameterCombiner(numIndexes, regionTestTypes);
}
- protected final Object[] parametersForIndexAndRegions() {
+ protected Object[] parametersForIndexAndRegions() {
Object[] indexCreations = new Object[] {getFieldsIndexWithOneField(),
getFieldsIndexWithTwoFields(), get2FieldsIndexes(), getAnalyzersIndexWithOneField(),
getAnalyzersIndexWithTwoFields(), getAnalyzersIndexWithNullField1()};
@@ -282,9 +282,7 @@ public class LuceneIndexCreationDUnitTest extends LuceneDUnitTest {
dataStore2.invoke(() -> verifyIndexList(0));
}
-
-
- protected final Object[] getXmlAndExceptionMessages() {
+ protected Object[] getXmlAndExceptionMessages() {
return $(
new Object[] {"verifyDifferentFieldsFails", CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_FIELDS},
new Object[] {"verifyDifferentFieldAnalyzerSizesFails1",
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
index bed6f13..a8ab8d3 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexCreationPersistenceIntegrationTest.java
@@ -224,8 +224,7 @@ public class LuceneIndexCreationPersistenceIntegrationTest extends LuceneIntegra
LuceneTestUtilities.verifyInternalRegions(luceneService, cache, verify);
}
-
- private static final Object[] getRegionShortcuts() {
+ private static Object[] getRegionShortcuts() {
return $(new Object[] {PARTITION}, new Object[] {PARTITION_REDUNDANT},
new Object[] {PARTITION_PERSISTENT}, new Object[] {PARTITION_REDUNDANT_PERSISTENT},
new Object[] {PARTITION_OVERFLOW}, new Object[] {PARTITION_REDUNDANT_OVERFLOW},
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
index 67adfb9..a6252c8 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
@@ -73,7 +73,7 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
accessor = Host.getHost(0).getVM(3);
}
- private final Object[] parametersForIndexDestroys() {
+ private Object[] parametersForIndexDestroys() {
String[] destroyDataRegionParameters = {"true", "false"};
RegionTestableType[] regionTestTypes = getListOfRegionTestTypes();
return parameterCombiner(destroyDataRegionParameters, regionTestTypes);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
index 4d72639..b378ca5 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
@@ -50,7 +50,7 @@ public class LuceneIndexCreationProfileJUnitTest {
assertEquals(profile.getFieldAnalyzers(), copy.getFieldAnalyzers());
}
- private final Object[] getSerializationProfiles() {
+ private Object[] getSerializationProfiles() {
return $(new Object[] {getOneFieldLuceneIndexCreationProfile()},
new Object[] {getTwoFieldLuceneIndexCreationProfile()},
new Object[] {getTwoAnalyzersLuceneIndexCreationProfile()},
@@ -64,7 +64,7 @@ public class LuceneIndexCreationProfileJUnitTest {
assertEquals(expectedResult, otherProfile.checkCompatibility("/" + REGION_NAME, myProfile));
}
- private final Object[] getCheckCompatibilityProfiles() {
+ private Object[] getCheckCompatibilityProfiles() {
return $(
new Object[] {getOneFieldLuceneIndexCreationProfile(),
getTwoFieldLuceneIndexCreationProfile(), CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_FIELDS},
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
----------------------------------------------------------------------
diff --git a/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java b/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
index d19d900..de8825b 100644
--- a/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
+++ b/geode-old-client-support/src/main/java/com/gemstone/gemfire/cache/execute/FunctionException.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.gemstone.gemfire.cache.execute;
import java.util.ArrayList;
@@ -36,12 +35,9 @@ import org.apache.geode.cache.execute.FunctionService;
* This allows for separation of business and error handling logic, as client code that processes
* function execution results does not have to deal with errors; errors can be dealt with in the
* exception handling logic, by catching this exception.
- *
* <p>
* The exception string provides details on the cause of failure.
- * </p>
- *
- *
+ *
* @since GemFire 6.0
* @see FunctionService
* @deprecated please use the org.apache.geode version of this class
@@ -96,7 +92,7 @@ public class FunctionException extends GemFireException {
* @param cause
* @since GemFire 6.5
*/
- public final void addException(Throwable cause) {
+ public void addException(Throwable cause) {
Assert.assertTrue(cause != null, "unexpected null exception to add to FunctionException");
getExceptions().add(cause);
}
@@ -106,7 +102,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final List<Throwable> getExceptions() {
+ public List<Throwable> getExceptions() {
if (this.exceptions == null) {
this.exceptions = new ArrayList<Throwable>();
}
@@ -118,7 +114,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final void addExceptions(Collection<? extends Throwable> ex) {
+ public void addExceptions(Collection<? extends Throwable> ex) {
getExceptions().addAll(ex);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java b/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
new file mode 100644
index 0000000..5104466
--- /dev/null
+++ b/geode-old-client-support/src/test/java/com/gemstone/gemfire/cache/execute/FunctionExceptionTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.gemstone.gemfire.cache.execute;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class FunctionExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FunctionException mockFunctionException = mock(FunctionException.class);
+ Throwable cause = new Exception("message");
+ List<Throwable> listOfThrowables = new ArrayList<>();
+ Collection<? extends Throwable> collectionOfThrowables = new ArrayList<>();
+
+ when(mockFunctionException.getExceptions()).thenReturn(listOfThrowables);
+
+ mockFunctionException.addException(cause);
+ mockFunctionException.addExceptions(collectionOfThrowables);
+
+ verify(mockFunctionException, times(1)).addException(cause);
+ verify(mockFunctionException, times(1)).addExceptions(collectionOfThrowables);
+
+ assertThat(mockFunctionException.getExceptions()).isSameAs(listOfThrowables);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
index f101027..8aa88b2 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/WANTestBase.java
@@ -3768,7 +3768,7 @@ public class WANTestBase extends JUnit4DistributedTestCase {
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
// For now all WANTestBase tests allocate off-heap memory even though
// many of them never use it.
// The problem is that WANTestBase has static methods that create instances
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
index ea9237e..03dc0ad 100644
--- a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
+++ b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/support/RegionData.java
@@ -15,45 +15,31 @@
package org.apache.geode.rest.internal.web.controllers.support;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializable;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import org.apache.geode.cache.query.Struct;
-import org.apache.geode.cache.query.internal.StructImpl;
import org.apache.geode.pdx.JSONFormatter;
import org.apache.geode.pdx.PdxInstance;
-import org.apache.geode.rest.internal.web.util.JSONUtils;
import org.apache.geode.rest.internal.web.util.JsonWriter;
-
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The RegionData class is a container for data fetched from a GemFire Cache Region.
- * <p/>
- *
+ *
* @see com.fasterxml.jackson.databind.JsonSerializable
* @see java.lang.Iterable
* @since GemFire 8.0
*/
-
@SuppressWarnings("unused")
@XmlRootElement(name = "region")
@XmlType(name = "org.gopivotal.app.web.controllers.support.RegionData")
@@ -75,18 +61,13 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
return regionNamePath;
}
- public final void setRegionNamePath(final String regionNamePath) {
+ public void setRegionNamePath(final String regionNamePath) {
Assert.hasText(regionNamePath, "The name or path of the Region must be specified!");
this.regionNamePath = regionNamePath;
}
public RegionData<T> add(final T data) {
- // We are adding null data into the response
- // Assert.notNull(data, String.format("The data to add to Region (%1$s) cannot be null!",
- // getRegionNamePath()));
- // if(data != null) {
this.data.add(data);
- // }
return this;
}
@@ -102,10 +83,6 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
public RegionData<T> add(final Iterable<T> data) {
for (final T element : data) {
- // Adding null data into the response
- /*
- * if (element != null) { add(element); }
- */
add(element);
}
@@ -139,19 +116,15 @@ public class RegionData<T> implements Iterable<T>, JsonSerializable {
public void serialize(final JsonGenerator jsonGenerator,
final SerializerProvider serializerProvider) throws IOException {
- // if(this!=null && this.size() > 1) {
jsonGenerator.writeStartObject();
jsonGenerator.writeArrayFieldStart(getRegionNamePath());
- // }
for (T element : this) {
JsonWriter.writeValueAsJson(jsonGenerator, element, null);
}
- // if(this!=null && this.size() > 1) {
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
- // }
}
public void serializeWithType(final JsonGenerator jsonGenerator,
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
new file mode 100644
index 0000000..5f32d13
--- /dev/null
+++ b/geode-web-api/src/test/java/org/apache/geode/rest/internal/web/controllers/support/RegionDataTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.rest.internal.web.controllers.support;
+
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RegionDataTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RegionData mockRegionData = mock(RegionData.class);
+ String regionNamePath = "regionNamePath";
+
+ mockRegionData.setRegionNamePath(regionNamePath);
+
+ verify(mockRegionData, times(1)).setRegionNamePath(regionNamePath);
+ }
+}
[15/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
GEODE-2929: remove superfluous final from methods
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/97a6e1ae
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/97a6e1ae
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/97a6e1ae
Branch: refs/heads/feature/GEODE-2632-16
Commit: 97a6e1ae58504ee04f22a4cafa93d6ea32b215e2
Parents: 8863195
Author: Kirk Lund <kl...@apache.org>
Authored: Fri May 19 14:23:17 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:54:35 2017 -0700
----------------------------------------------------------------------
.../internal/web/RestInterfaceJUnitTest.java | 2 +-
.../java/org/apache/geode/CancelCriterion.java | 4 +-
.../org/apache/geode/CanonicalInstantiator.java | 6 +-
.../java/org/apache/geode/DataSerializer.java | 30 ++---
.../java/org/apache/geode/Instantiator.java | 20 +---
.../geode/admin/RegionSubRegionSnapshot.java | 16 +--
.../apache/geode/cache/DiskAccessException.java | 4 +-
.../geode/cache/DynamicRegionFactory.java | 3 +-
.../org/apache/geode/cache/EvictionAction.java | 10 +-
.../apache/geode/cache/EvictionAlgorithm.java | 16 +--
.../apache/geode/cache/EvictionAttributes.java | 4 +-
.../geode/cache/FixedPartitionAttributes.java | 10 +-
.../geode/cache/MembershipAttributes.java | 16 ++-
.../geode/cache/client/internal/AbstractOp.java | 2 +-
.../geode/cache/execute/FunctionException.java | 10 +-
.../cache/query/internal/ObjectIntHashMap.java | 13 +--
.../geode/compression/SnappyCompressor.java | 2 +-
.../geode/distributed/AbstractLauncher.java | 2 +-
.../geode/distributed/LocatorLauncher.java | 6 +-
.../geode/distributed/ServerLauncher.java | 12 +-
.../internal/DistributionAdvisor.java | 15 ++-
.../internal/DistributionManager.java | 52 +++++++--
.../internal/DistributionMessage.java | 6 +-
.../distributed/internal/ReplyProcessor21.java | 14 ++-
.../apache/geode/internal/AbstractConfig.java | 3 +-
.../geode/internal/HeapDataOutputStream.java | 26 +++--
.../geode/internal/ObjIdConcurrentMap.java | 27 ++---
.../apache/geode/internal/SharedLibrary.java | 2 +-
.../org/apache/geode/internal/SystemTimer.java | 2 +-
.../internal/cache/AbstractDiskRegion.java | 35 +++---
.../internal/cache/AbstractLRURegionMap.java | 9 +-
.../cache/AbstractOplogDiskRegionEntry.java | 2 +-
.../geode/internal/cache/AbstractRegion.java | 4 +-
.../geode/internal/cache/AbstractRegionMap.java | 2 +-
.../geode/internal/cache/BucketAdvisor.java | 5 +-
.../geode/internal/cache/DestroyOperation.java | 9 +-
.../internal/cache/DistPeerTXStateStub.java | 5 +-
.../cache/DistributedCacheOperation.java | 8 +-
.../cache/DistributedPutAllOperation.java | 3 +-
.../geode/internal/cache/DistributedRegion.java | 2 +-
...stributedRegionFunctionStreamingMessage.java | 4 +-
.../cache/DistributedRemoveAllOperation.java | 12 +-
.../apache/geode/internal/cache/ExpiryTask.java | 2 +-
.../geode/internal/cache/GemFireCacheImpl.java | 2 +-
.../geode/internal/cache/GridAdvisor.java | 14 +--
.../internal/cache/InitialImageOperation.java | 6 +-
.../cache/MemberFunctionStreamingMessage.java | 2 +-
.../internal/cache/NonLocalRegionEntry.java | 8 +-
.../cache/PartitionedRegionDataStore.java | 57 +--------
.../internal/cache/PlaceHolderDiskRegion.java | 4 +-
.../geode/internal/cache/ProxyBucketRegion.java | 2 +-
.../internal/cache/RemoteFetchEntryMessage.java | 8 +-
.../internal/cache/RemotePutAllMessage.java | 3 +-
.../internal/cache/RemoteRemoveAllMessage.java | 2 +-
.../internal/cache/StateFlushOperation.java | 2 +-
.../apache/geode/internal/cache/TXEvent.java | 7 +-
.../org/apache/geode/internal/cache/TXId.java | 8 +-
.../apache/geode/internal/cache/TXMessage.java | 2 +-
.../apache/geode/internal/cache/TXState.java | 14 ---
.../geode/internal/cache/TXStateStub.java | 16 +--
.../cache/VMStatsDiskLRURegionEntryHeap.java | 5 +-
.../cache/VMStatsDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VMStatsDiskRegionEntryHeap.java | 5 +-
.../cache/VMStatsDiskRegionEntryOffHeap.java | 5 +-
.../cache/VMStatsLRURegionEntryHeap.java | 5 +-
.../cache/VMStatsLRURegionEntryOffHeap.java | 5 +-
.../internal/cache/VMStatsRegionEntryHeap.java | 5 +-
.../cache/VMStatsRegionEntryOffHeap.java | 5 +-
.../cache/VMThinDiskLRURegionEntryHeap.java | 5 +-
.../cache/VMThinDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VMThinDiskRegionEntryHeap.java | 5 +-
.../cache/VMThinDiskRegionEntryOffHeap.java | 5 +-
.../cache/VMThinLRURegionEntryHeap.java | 5 +-
.../cache/VMThinLRURegionEntryOffHeap.java | 5 +-
.../internal/cache/VMThinRegionEntryHeap.java | 4 +-
.../cache/VMThinRegionEntryOffHeap.java | 4 +-
.../VersionedStatsDiskLRURegionEntryHeap.java | 5 +-
...VersionedStatsDiskLRURegionEntryOffHeap.java | 5 +-
.../VersionedStatsDiskRegionEntryHeap.java | 5 +-
.../VersionedStatsDiskRegionEntryOffHeap.java | 5 +-
.../cache/VersionedStatsLRURegionEntryHeap.java | 5 +-
.../VersionedStatsLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedStatsRegionEntryHeap.java | 5 +-
.../cache/VersionedStatsRegionEntryOffHeap.java | 5 +-
.../VersionedThinDiskLRURegionEntryHeap.java | 5 +-
.../VersionedThinDiskLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinDiskRegionEntryHeap.java | 5 +-
.../VersionedThinDiskRegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinLRURegionEntryHeap.java | 5 +-
.../VersionedThinLRURegionEntryOffHeap.java | 5 +-
.../cache/VersionedThinRegionEntryHeap.java | 5 +-
.../cache/VersionedThinRegionEntryOffHeap.java | 5 +-
.../internal/cache/control/ResourceAdvisor.java | 2 +-
.../internal/cache/locks/TXLockIdImpl.java | 6 +-
.../geode/internal/cache/lru/LRUAlgorithm.java | 42 ++-----
.../cache/partitioned/BucketBackupMessage.java | 4 +-
.../partitioned/DeposePrimaryBucketMessage.java | 4 +-
.../cache/partitioned/FetchEntryMessage.java | 18 +--
.../FetchPartitionDetailsMessage.java | 4 +-
.../cache/partitioned/MoveBucketMessage.java | 5 +-
.../cache/partitioned/PartitionMessage.java | 14 +--
.../cache/partitioned/RemoveAllPRMessage.java | 4 +-
.../cache/partitioned/RemoveBucketMessage.java | 6 +-
.../internal/cache/partitioned/SizeMessage.java | 8 +-
.../cache/tier/sockets/CacheClientUpdater.java | 4 +-
.../geode/internal/cache/tier/sockets/Part.java | 20 +---
.../parallel/ParallelGatewaySenderQueue.java | 22 ----
.../cache/wan/serial/BatchDestroyOperation.java | 10 +-
.../CacheTransactionManagerCreation.java | 10 +-
.../cache/xmlcache/CacheXmlVersion.java | 7 +-
.../cache/xmlcache/DefaultEntityResolver2.java | 9 +-
.../internal/statistics/StatArchiveWriter.java | 4 +-
.../apache/geode/internal/tcp/Connection.java | 117 +++++++++----------
.../management/internal/IdentityConverter.java | 5 +-
.../management/internal/OpenTypeConverter.java | 63 ++--------
.../management/internal/cli/json/TypedJson.java | 19 +--
.../management/internal/web/domain/Link.java | 6 +-
.../internal/web/http/ClientHttpRequest.java | 2 +-
.../internal/executor/AbstractScanExecutor.java | 6 +-
.../org/apache/geode/DataSerializerTest.java | 50 ++++++++
.../java/org/apache/geode/InstantiatorTest.java | 53 +++++++++
.../admin/RegionSubRegionSnapshotTest.java | 58 +++++++++
.../cache/ConnectionPoolFactoryJUnitTest.java | 2 +-
.../geode/cache/DiskAccessExceptionTest.java | 34 ++++++
.../cache/client/internal/AbstractOpTest.java | 39 +++++++
.../cache/execute/FunctionExceptionTest.java | 51 ++++++++
.../query/functional/PdxOrderByJUnitTest.java | 6 +-
...pdateWithInplaceObjectModFalseDUnitTest.java | 2 +-
.../cache30/CacheSerializableRunnable.java | 4 +-
.../apache/geode/cache30/RegionTestCase.java | 4 +-
.../geode/cache30/TXDistributedDUnitTest.java | 2 +-
.../apache/geode/cache30/TestCacheCallback.java | 2 +-
.../apache/geode/cache30/TestCacheListener.java | 12 +-
.../apache/geode/cache30/TestCacheLoader.java | 2 +-
.../apache/geode/cache30/TestCacheWriter.java | 19 ++-
.../geode/cache30/TestTransactionListener.java | 6 +-
.../geode/distributed/AbstractLauncherTest.java | 10 ++
...ocatorLauncherRemoteIntegrationTestCase.java | 2 +-
...ServerLauncherRemoteIntegrationTestCase.java | 2 +-
.../geode/distributed/LocatorLauncherTest.java | 19 ++-
.../geode/distributed/ServerLauncherTest.java | 30 +++++
.../internal/DistributionAdvisorTest.java | 34 ++++++
.../internal/DistributionManagerTest.java | 43 +++++++
.../internal/DistributionMessageTest.java | 37 ++++++
.../internal/ReplyProcessor21Test.java | 38 ++++++
.../geode/internal/AbstractConfigTest.java | 34 ++++++
.../internal/DataSerializableJUnitTest.java | 4 +-
.../internal/HeapDataOutputStreamTest.java | 35 ++++++
.../geode/internal/ObjIdConcurrentMapTest.java | 39 +++++++
.../internal/cache/AbstractDiskRegionTest.java | 42 +++++++
.../cache/AbstractLRURegionMapTest.java | 44 +++++++
.../cache/AbstractOplogDiskRegionEntryTest.java | 38 ++++++
.../internal/cache/AbstractRegionMapTest.java | 35 +++++-
.../internal/cache/AbstractRegionTest.java | 39 +++++++
.../geode/internal/cache/BucketAdvisorTest.java | 40 +++++++
.../geode/internal/cache/Bug37377DUnitTest.java | 4 +-
.../geode/internal/cache/Bug39079DUnitTest.java | 4 +-
.../cache/CacheOperationMessageTest.java | 50 ++++++++
.../internal/cache/DestroyMessageTest.java | 42 +++++++
.../cache/DiskRegCacheXmlJUnitTest.java | 2 +-
.../cache/DiskRegionClearJUnitTest.java | 2 +-
.../internal/cache/DiskRegionTestingBase.java | 2 +-
.../internal/cache/DistPeerTXStateStubTest.java | 44 +++++++
.../cache/DistributedCacheOperationTest.java | 50 ++++++++
.../cache/DistributedPutAllOperationTest.java | 38 ++++++
...butedRegionFunctionStreamingMessageTest.java | 44 +++++++
.../internal/cache/DistributedRegionTest.java | 42 +++++++
.../DistributedRemoveAllOperationTest.java | 38 ++++++
.../geode/internal/cache/ExpiryTaskTest.java | 34 ++++++
.../internal/cache/GemFireCacheImplTest.java | 13 +++
.../geode/internal/cache/GridProfileTest.java | 61 ++++++++++
.../MemberFunctionStreamingMessageTest.java | 39 +++++++
.../internal/cache/NonLocalRegionEntryTest.java | 45 +++++++
...gionBucketCreationDistributionDUnitTest.java | 4 +-
.../cache/PlaceHolderDiskRegionTest.java | 34 ++++++
.../internal/cache/ProxyBucketRegionTest.java | 37 ++++++
.../cache/RemoteFetchEntryMessageTest.java | 43 +++++++
.../internal/cache/RemotePutAllMessageTest.java | 39 +++++++
.../cache/RemoteRemoveAllMessageTest.java | 39 +++++++
.../cache/RequestFilterInfoMessageTest.java | 35 ++++++
.../internal/cache/RequestImageMessageTest.java | 35 ++++++
.../internal/cache/RequestRVVMessageTest.java | 35 ++++++
.../internal/cache/StateMarkerMessageTest.java | 35 ++++++
.../geode/internal/cache/TXEventTest.java | 36 ++++++
.../geode/internal/cache/TXMessageTest.java | 36 ++++++
.../geode/internal/cache/TXStateStubTest.java | 38 ++++++
.../apache/geode/internal/cache/UnzipUtil.java | 4 +-
.../cache/control/ResourceAdvisorTest.java | 37 ++++++
.../internal/cache/ha/ConflatableObject.java | 20 ++--
.../internal/cache/lru/LRUAlgorithmTest.java | 34 ++++++
.../partitioned/BucketBackupMessageTest.java | 34 ++++++
.../ColocatedRegionDetailsJUnitTest.java | 73 ++++--------
.../DeposePrimaryBucketMessageTest.java | 42 +++++++
.../partitioned/FetchEntryMessageTest.java | 48 ++++++++
.../FetchPartitionDetailsMessageTest.java | 45 +++++++
.../partitioned/MoveBucketMessageTest.java | 44 +++++++
.../cache/partitioned/PartitionMessageTest.java | 31 +++--
.../partitioned/RemoveAllPRMessageTest.java | 37 ++++++
.../partitioned/RemoveBucketMessageTest.java | 44 +++++++
.../cache/partitioned/SizeMessageTest.java | 33 ++++++
.../cache/tier/sockets/CCUStatsTest.java | 39 +++++++
.../internal/cache/tier/sockets/PartTest.java | 41 +++++++
.../versions/RegionVersionHolderJUnitTest.java | 2 +-
.../cache/versions/TombstoneDUnitTest.java | 2 +-
.../cache/wan/AsyncEventQueueTestBase.java | 2 +-
.../AsyncEventQueueValidationsJUnitTest.java | 2 +-
.../cache/wan/serial/DestroyMessageTest.java | 43 +++++++
.../CacheTransactionManagerCreationTest.java | 47 ++++++++
.../xmlcache/DefaultEntityResolver2Test.java | 40 +++++++
.../internal/jta/functional/CacheJUnitTest.java | 2 +-
.../jta/functional/TestXACacheLoader.java | 2 +-
.../internal/logging/LogServiceJUnitTest.java | 2 +-
.../logging/log4j/AlertAppenderJUnitTest.java | 4 +-
.../log4j/LogWriterAppenderJUnitTest.java | 6 +-
.../statistics/StatArchiveWriterTest.java | 39 +++++++
.../geode/internal/tcp/ConnectionTest.java | 45 +++++++
.../internal/CompositeBuilderViaFromTest.java | 45 +++++++
.../internal/CompositeBuilderViaProxyTest.java | 45 +++++++
.../internal/IdentityConverterTest.java | 36 ++++++
.../cli/commands/CliCommandTestBase.java | 4 +-
.../cli/commands/ConfigCommandsDUnitTest.java | 2 +-
.../cli/functions/ExportedLogsSizeInfoTest.java | 18 +--
.../ShowMissingDiskStoresFunctionJUnitTest.java | 82 +++----------
.../internal/cli/json/TypedJsonTest.java | 38 ++++++
.../WanCommandsControllerJUnitTest.java | 2 +-
.../internal/web/domain/LinkTest.java | 45 +++++++
.../web/http/ClientHttpRequestTest.java | 37 ++++++
.../geode/pdx/PdxSerializableDUnitTest.java | 2 +-
.../executor/AbstractScanExecutorTest.java | 39 +++++++
.../security/ClientAuthorizationTestCase.java | 4 +-
.../DeltaClientAuthorizationDUnitTest.java | 2 +-
.../DeltaClientPostAuthorizationDUnitTest.java | 2 +-
.../generator/AuthzCredentialGenerator.java | 8 +-
.../security/generator/CredentialGenerator.java | 8 +-
.../org/apache/geode/test/dunit/DUnitEnv.java | 2 +-
.../geode/test/dunit/DistributedTestUtils.java | 2 +-
.../java/org/apache/geode/test/dunit/Wait.java | 6 +-
...ingGetPropertiesDisconnectsAllDUnitTest.java | 2 +-
.../geode/test/golden/FailOutputTestCase.java | 3 +-
.../apache/geode/test/golden/PassJUnitTest.java | 2 +-
.../golden/PassWithExpectedProblemTestCase.java | 2 +-
.../internal/cache/ha/CQListGIIDUnitTest.java | 2 +-
.../geode/cache/lucene/LuceneDUnitTest.java | 2 +-
.../lucene/LuceneIndexCreationDUnitTest.java | 8 +-
...IndexCreationPersistenceIntegrationTest.java | 3 +-
.../lucene/LuceneIndexDestroyDUnitTest.java | 2 +-
.../LuceneIndexCreationProfileJUnitTest.java | 4 +-
.../cache/execute/FunctionException.java | 12 +-
.../cache/execute/FunctionExceptionTest.java | 48 ++++++++
.../geode/internal/cache/wan/WANTestBase.java | 2 +-
.../web/controllers/support/RegionData.java | 47 ++------
.../web/controllers/support/RegionDataTest.java | 35 ++++++
252 files changed, 3523 insertions(+), 1008 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
index 324284e..7cdc104 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/RestInterfaceJUnitTest.java
@@ -403,7 +403,7 @@ public class RestInterfaceJUnitTest {
this.lastName = lastName;
}
- protected final String format(final Date dateTime) {
+ protected String format(final Date dateTime) {
return format(dateTime, DEFAULT_BIRTH_DATE_FORMAT_PATTERN);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
index fec3827..704da8e 100644
--- a/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
+++ b/geode-core/src/main/java/org/apache/geode/CancelCriterion.java
@@ -58,7 +58,7 @@ public abstract class CancelCriterion {
*
* @return failure string if system failure has occurred
*/
- protected final String checkFailure() {
+ protected String checkFailure() {
Throwable tilt = SystemFailure.getFailure();
if (tilt != null) {
// Allocate no objects here!
@@ -74,7 +74,7 @@ public abstract class CancelCriterion {
* @param e an underlying exception or null if there is no exception that triggered this check
* @see #cancelInProgress()
*/
- public final void checkCancelInProgress(Throwable e) {
+ public void checkCancelInProgress(Throwable e) {
SystemFailure.checkFailure();
String reason = cancelInProgress();
if (reason == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
index 10e6f16..af34363 100644
--- a/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/CanonicalInstantiator.java
@@ -14,7 +14,8 @@
*/
package org.apache.geode;
-import java.io.*;
+import java.io.DataInput;
+import java.io.IOException;
/**
* <code>CanonicalInstantiator</code> is much like its parent <code>Instantiator</code> except that
@@ -31,6 +32,7 @@ import java.io.*;
* @since GemFire 5.1
*/
public abstract class CanonicalInstantiator extends Instantiator {
+
/**
* Creates a new <code>CanonicalInstantiator</code> that instantiates a given class.
*
@@ -54,7 +56,7 @@ public abstract class CanonicalInstantiator extends Instantiator {
* @throws UnsupportedOperationException in all cases
*/
@Override
- public final DataSerializable newInstance() {
+ public DataSerializable newInstance() {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/DataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/DataSerializer.java b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
index 34501f8..2d16459 100644
--- a/geode-core/src/main/java/org/apache/geode/DataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
@@ -193,10 +193,6 @@ public abstract class DataSerializer {
protected static final ThreadLocal<Boolean> DISALLOW_JAVA_SERIALIZATION =
new ThreadLocal<Boolean>();
- ////////////////////// Instance Fields /////////////////////
-
- ////////////////////// Static Methods //////////////////////
-
/**
* Writes an instance of <code>Class</code> to a <code>DataOutput</code>. This method will handle
* a <code>null</code> value and not throw a <code>NullPointerException</code>.
@@ -322,7 +318,6 @@ public abstract class DataSerializer {
return rgn;
}
-
/**
* Writes an instance of <code>Date</code> to a <code>DataOutput</code>. Note that even though
* <code>date</code> may be an instance of a subclass of <code>Date</code>, <code>readDate</code>
@@ -509,7 +504,7 @@ public abstract class DataSerializer {
out.writeByte(DSCODE.NULL_STRING);
} else {
- // [bruce] writeUTF is expensive - it creates a char[] to fetch
+ // writeUTF is expensive - it creates a char[] to fetch
// the string's contents, iterates over the array to compute the
// encoded length, creates a byte[] to hold the encoded bytes,
// iterates over the char[] again to create the encode bytes,
@@ -2903,7 +2898,7 @@ public abstract class DataSerializer {
* @see Instantiator
* @see ObjectOutputStream#writeObject
*/
- public static final void writeObject(Object o, DataOutput out, boolean allowJavaSerialization)
+ public static void writeObject(Object o, DataOutput out, boolean allowJavaSerialization)
throws IOException {
if (allowJavaSerialization) {
@@ -2937,7 +2932,7 @@ public abstract class DataSerializer {
* @see DataSerializer
* @see ObjectOutputStream#writeObject
*/
- public static final void writeObject(Object o, DataOutput out) throws IOException {
+ public static void writeObject(Object o, DataOutput out) throws IOException {
InternalDataSerializer.basicWriteObject(o, out, false);
}
@@ -2962,8 +2957,7 @@ public abstract class DataSerializer {
* @see ObjectInputStream#readObject
*/
@SuppressWarnings("unchecked")
- public static final <T> T readObject(final DataInput in)
- throws IOException, ClassNotFoundException {
+ public static <T> T readObject(final DataInput in) throws IOException, ClassNotFoundException {
return (T) InternalDataSerializer.basicReadObject(in);
}
@@ -2997,12 +2991,10 @@ public abstract class DataSerializer {
* the classes reserved by DataSerializer (see {@link #getSupportedClasses} for a list).
* @see #getSupportedClasses
*/
- public static final DataSerializer register(Class<?> c) {
+ public static DataSerializer register(Class<?> c) {
return InternalDataSerializer.register(c, true);
}
- /////////////////////// Constructors ///////////////////////
-
/**
* Creates a new <code>DataSerializer</code>. All class that implement <code>DataSerializer</code>
* must provide a zero-argument constructor.
@@ -3010,11 +3002,9 @@ public abstract class DataSerializer {
* @see #register(Class)
*/
public DataSerializer() {
-
+ // nothing
}
- ///////////////////// Instance Methods /////////////////////
-
/**
* Returns the <code>Class</code>es whose instances are data serialized by this
* <code>DataSerializer</code>. This method is invoked when this serializer is
@@ -3111,7 +3101,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final void setEventId(Object/* EventID */ eventId) {
+ public void setEventId(Object/* EventID */ eventId) {
this.eventId = (EventID) eventId;
}
@@ -3121,7 +3111,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final Object/* EventID */ getEventId() {
+ public Object/* EventID */ getEventId() {
return this.eventId;
}
@@ -3130,7 +3120,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final void setContext(Object/* ClientProxyMembershipID */ context) {
+ public void setContext(Object/* ClientProxyMembershipID */ context) {
this.context = (ClientProxyMembershipID) context;
}
@@ -3139,7 +3129,7 @@ public abstract class DataSerializer {
*
* @since GemFire 6.5
*/
- public final Object/* ClientProxyMembershipID */ getContext() {
+ public Object/* ClientProxyMembershipID */ getContext() {
return this.context;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/Instantiator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/Instantiator.java b/geode-core/src/main/java/org/apache/geode/Instantiator.java
index e4da556..3c1ca06 100644
--- a/geode-core/src/main/java/org/apache/geode/Instantiator.java
+++ b/geode-core/src/main/java/org/apache/geode/Instantiator.java
@@ -142,9 +142,6 @@ public abstract class Instantiator {
/** The originator of this <code>Instantiator</code> */
private ClientProxyMembershipID context;
-
- /////////////////////// Static Methods ///////////////////////
-
/**
* Registers a <code>DataSerializable</code> class with the data serialization framework. This
* method is usually invoked from the static initializer of a class that implements
@@ -182,8 +179,6 @@ public abstract class Instantiator {
InternalInstantiator.register(instantiator, distribute);
}
- //////////////////////// Constructors ////////////////////////
-
/**
* Creates a new <code>Instantiator</code> that instantiates a given class.
*
@@ -217,8 +212,6 @@ public abstract class Instantiator {
this.id = classId;
}
- ////////////////////// Instance Methods //////////////////////
-
/**
* Creates a new "empty" instance of a <Code>DataSerializable</code> class whose state will be
* filled in by invoking its {@link DataSerializable#fromData fromData} method.
@@ -231,21 +224,21 @@ public abstract class Instantiator {
* Returns the <code>DataSerializable</code> class that is instantiated by this
* <code>Instantiator</code>.
*/
- public final Class<? extends DataSerializable> getInstantiatedClass() {
+ public Class<? extends DataSerializable> getInstantiatedClass() {
return this.clazz;
}
/**
* Returns the unique <code>id</code> of this <code>Instantiator</code>.
*/
- public final int getId() {
+ public int getId() {
return this.id;
}
/**
* sets the unique <code>eventId</code> of this <code>Instantiator</code>. For internal use only.
*/
- public final void setEventId(Object/* EventID */ eventId) {
+ public void setEventId(Object/* EventID */ eventId) {
this.eventId = (EventID) eventId;
}
@@ -253,23 +246,22 @@ public abstract class Instantiator {
* Returns the unique <code>eventId</code> of this <code>Instantiator</code>. For internal use
* only.
*/
- public final Object/* EventID */ getEventId() {
+ public Object/* EventID */ getEventId() {
return this.eventId;
}
/**
* sets the context of this <code>Instantiator</code>. For internal use only.
*/
- public final void setContext(Object/* ClientProxyMembershipID */ context) {
+ public void setContext(Object/* ClientProxyMembershipID */ context) {
this.context = (ClientProxyMembershipID) context;
}
/**
* Returns the context of this <code>Instantiator</code>. For internal use only.
*/
- public final Object/* ClientProxyMembershipID */ getContext() {
+ public Object/* ClientProxyMembershipID */ getContext() {
return this.context;
}
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java b/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
index 19f89b2..69774b8 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/RegionSubRegionSnapshot.java
@@ -83,56 +83,56 @@ public class RegionSubRegionSnapshot implements DataSerializable {
/**
* @return get entry count of region
*/
- public final int getEntryCount() {
+ public int getEntryCount() {
return entryCount;
}
/**
* @param entryCount entry count of region
*/
- public final void setEntryCount(int entryCount) {
+ public void setEntryCount(int entryCount) {
this.entryCount = entryCount;
}
/**
* @return name of region
*/
- public final String getName() {
+ public String getName() {
return name;
}
/**
* @param name name of region
*/
- public final void setName(String name) {
+ public void setName(String name) {
this.name = name;
}
/**
* @return subRegionSnapshots of all the sub regions
*/
- public final Set getSubRegionSnapshots() {
+ public Set getSubRegionSnapshots() {
return subRegionSnapshots;
}
/**
* @param subRegionSnapshots subRegionSnapshots of all the sub regions
*/
- public final void setSubRegionSnapshots(Set subRegionSnapshots) {
+ public void setSubRegionSnapshots(Set subRegionSnapshots) {
this.subRegionSnapshots = subRegionSnapshots;
}
/**
* @return snapshot of parent region
*/
- public final RegionSubRegionSnapshot getParent() {
+ public RegionSubRegionSnapshot getParent() {
return parent;
}
/**
* @param parent snapshot of parent region
*/
- public final void setParent(RegionSubRegionSnapshot parent) {
+ public void setParent(RegionSubRegionSnapshot parent) {
this.parent = parent;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java b/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
index e77e485..fb640cd 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/DiskAccessException.java
@@ -19,8 +19,6 @@ import java.io.IOException;
/**
* Indicates that an <code>IOException</code> during a disk region operation.
*
- *
- *
* @since GemFire 3.2
*/
public class DiskAccessException extends CacheRuntimeException {
@@ -114,7 +112,7 @@ public class DiskAccessException extends CacheRuntimeException {
/**
* Returns true if this exception originated from a remote node.
*/
- public final boolean isRemote() {
+ public boolean isRemote() {
return this.isRemote;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
index 9bf14cd..e9e64e7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/DynamicRegionFactory.java
@@ -32,7 +32,6 @@ import org.apache.geode.cache.client.internal.ServerRegionProxy;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.DynamicRegionAttributes;
@@ -995,7 +994,7 @@ public abstract class DynamicRegionFactory {
// while internal, its contents should be communicated with bridge clients
@Override
- final public boolean shouldNotifyBridgeClients() {
+ public boolean shouldNotifyBridgeClients() {
return getCache().getCacheServers().size() > 0;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
index a8513d9..0fd1b27 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAction.java
@@ -55,7 +55,7 @@ public final class EvictionAction extends EnumSyntax {
private static final String[] stringTable = {"none", "local-destroy", "overflow-to-disk",};
@Override
- final protected String[] getStringTable() {
+ protected String[] getStringTable() {
return stringTable;
}
@@ -64,19 +64,19 @@ public final class EvictionAction extends EnumSyntax {
{NONE, LOCAL_DESTROY, OVERFLOW_TO_DISK};
@Override
- final protected EnumSyntax[] getEnumValueTable() {
+ protected EnumSyntax[] getEnumValueTable() {
return enumValueTable;
}
- public final boolean isLocalDestroy() {
+ public boolean isLocalDestroy() {
return this == LOCAL_DESTROY;
}
- public final boolean isOverflowToDisk() {
+ public boolean isOverflowToDisk() {
return this == OVERFLOW_TO_DISK;
}
- public final boolean isNone() {
+ public boolean isNone() {
return this == NONE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
index 96b55b6..f57f257 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAlgorithm.java
@@ -25,6 +25,7 @@ import javax.print.attribute.EnumSyntax;
*/
public final class EvictionAlgorithm extends EnumSyntax {
private static final long serialVersionUID = 5778669432033106789L;
+
/**
* The canonical EvictionAction that represents no eviction action
*/
@@ -71,16 +72,15 @@ public final class EvictionAlgorithm extends EnumSyntax {
"lru-memory-size", "lifo-entry-count", "lifo-memory-size"};
@Override
- final protected String[] getStringTable() {
+ protected String[] getStringTable() {
return stringTable;
}
- // TODO post Java 1.8.0u45 uncomment final flag, see JDK-8076152
- private static /* final */ EvictionAlgorithm[] enumValueTable =
+ private static final EvictionAlgorithm[] enumValueTable =
{NONE, LRU_ENTRY, LRU_HEAP, LRU_MEMORY, LIFO_ENTRY, LIFO_MEMORY,};
@Override
- final protected EnumSyntax[] getEnumValueTable() {
+ protected EnumSyntax[] getEnumValueTable() {
return enumValueTable;
}
@@ -111,15 +111,15 @@ public final class EvictionAlgorithm extends EnumSyntax {
return null;
}
- public final boolean isLRUEntry() {
+ public boolean isLRUEntry() {
return this == LRU_ENTRY;
}
- public final boolean isLRUMemory() {
+ public boolean isLRUMemory() {
return this == LRU_MEMORY;
}
- public final boolean isLRUHeap() {
+ public boolean isLRUHeap() {
return this == LRU_HEAP;
}
@@ -128,7 +128,7 @@ public final class EvictionAlgorithm extends EnumSyntax {
return this.isLRUEntry() || this.isLRUMemory() || this.isLRUHeap();
}
- public final boolean isNone() {
+ public boolean isNone() {
return this == NONE;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
index 8c30b30..cdd8aeb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/EvictionAttributes.java
@@ -435,7 +435,7 @@ public abstract class EvictionAttributes implements DataSerializable {
public abstract EvictionAction getAction();
@Override
- public final boolean equals(final Object obj) {
+ public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
@@ -455,7 +455,7 @@ public abstract class EvictionAttributes implements DataSerializable {
}
@Override
- public final int hashCode() {
+ public int hashCode() {
if (getAlgorithm().isLRUHeap()) {
return getAlgorithm().hashCode();
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
index dd8bd94..b257bfa 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/FixedPartitionAttributes.java
@@ -32,7 +32,6 @@ import org.apache.geode.internal.cache.FixedPartitionAttributesImpl;
*
* @since GemFire 6.6
*/
-
public abstract class FixedPartitionAttributes {
private final static boolean DEFAULT_PRIMARY_STATUS = false;
@@ -44,7 +43,7 @@ public abstract class FixedPartitionAttributes {
*
* @param name Name of the fixed partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name) {
+ public static FixedPartitionAttributes createFixedPartition(String name) {
return new FixedPartitionAttributesImpl().setPartitionName(name)
.isPrimary(DEFAULT_PRIMARY_STATUS).setNumBuckets(DEFAULT_NUM_BUCKETS);
}
@@ -55,8 +54,7 @@ public abstract class FixedPartitionAttributes {
* @param name Name of the fixed partition.
* @param isPrimary True if this member is the primary for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name,
- boolean isPrimary) {
+ public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary) {
return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(isPrimary)
.setNumBuckets(DEFAULT_NUM_BUCKETS);
}
@@ -68,7 +66,7 @@ public abstract class FixedPartitionAttributes {
* @param isPrimary True if this member is the primary for the partition.
* @param numBuckets Number of buckets allowed for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary,
+ public static FixedPartitionAttributes createFixedPartition(String name, boolean isPrimary,
int numBuckets) {
return new FixedPartitionAttributesImpl().setPartitionName(name).isPrimary(isPrimary)
.setNumBuckets(numBuckets);
@@ -80,7 +78,7 @@ public abstract class FixedPartitionAttributes {
* @param name Name of the fixed partition.
* @param numBuckets Number of buckets allowed for the partition.
*/
- final public static FixedPartitionAttributes createFixedPartition(String name, int numBuckets) {
+ public static FixedPartitionAttributes createFixedPartition(String name, int numBuckets) {
return new FixedPartitionAttributesImpl().setPartitionName(name)
.isPrimary(DEFAULT_PRIMARY_STATUS).setNumBuckets(numBuckets);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
index 79f7d8a..4479899 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/MembershipAttributes.java
@@ -16,12 +16,20 @@ package org.apache.geode.cache;
import org.apache.geode.DataSerializable;
import org.apache.geode.DataSerializer;
-import org.apache.geode.distributed.internal.membership.InternalRole;
import org.apache.geode.distributed.Role;
+import org.apache.geode.distributed.internal.membership.InternalRole;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.io.*;
-import java.util.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
/**
* Configuration attributes for defining reliability requirements and behavior for a
@@ -142,7 +150,7 @@ public class MembershipAttributes implements DataSerializable, Externalizable {
return this.resumptionAction;
}
- private final Set<Role> toRoleSet(String[] roleNames) {
+ private Set<Role> toRoleSet(String[] roleNames) {
if (roleNames == null || roleNames.length == 0) {
return Collections.emptySet();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
index 593375e..a0cb7d4 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AbstractOp.java
@@ -274,7 +274,7 @@ public abstract class AbstractOp implements Op {
* @throws Exception if response could not be processed or we received a response with a server
* exception.
*/
- protected final Object processObjResponse(Message msg, String opName) throws Exception {
+ protected Object processObjResponse(Message msg, String opName) throws Exception {
Part part = msg.getPart(0);
final int msgType = msg.getMessageType();
if (msgType == MessageType.RESPONSE) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
index 3198b0d..54b4427 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionException.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache.execute;
import java.util.ArrayList;
@@ -37,8 +36,7 @@ import org.apache.geode.internal.Assert;
* <p>
* The exception string provides details on the cause of failure.
* </p>
- *
- *
+ *
* @since GemFire 6.0
* @see FunctionService
*/
@@ -92,7 +90,7 @@ public class FunctionException extends GemFireException {
* @param cause
* @since GemFire 6.5
*/
- public final void addException(Throwable cause) {
+ public void addException(Throwable cause) {
Assert.assertTrue(cause != null, "unexpected null exception to add to FunctionException");
getExceptions().add(cause);
}
@@ -102,7 +100,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final List<Throwable> getExceptions() {
+ public List<Throwable> getExceptions() {
if (this.exceptions == null) {
this.exceptions = new ArrayList<Throwable>();
}
@@ -114,7 +112,7 @@ public class FunctionException extends GemFireException {
*
* @since GemFire 6.5
*/
- public final void addExceptions(Collection<? extends Throwable> ex) {
+ public void addExceptions(Collection<? extends Throwable> ex) {
getExceptions().addAll(ex);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
index d0cf5db..8a82181 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/ObjectIntHashMap.java
@@ -113,7 +113,6 @@ import java.util.TreeMap;
* @since 1.2
* @since GemFire 7.1
*/
-
public class ObjectIntHashMap implements Cloneable, Serializable {
private static final long serialVersionUID = 7718697444988416372L;
@@ -761,21 +760,21 @@ public class ObjectIntHashMap implements Cloneable, Serializable {
hash = h;
}
- public final Object getKey() {
+ public Object getKey() {
return key;
}
- public final int getValue() {
+ public int getValue() {
return value;
}
- public final int setValue(int newValue) {
+ public int setValue(int newValue) {
int oldValue = value;
value = newValue;
return oldValue;
}
- public final boolean equals(Object o) {
+ public boolean equals(Object o) {
if (!(o instanceof Entry))
return false;
Entry e = (Entry) o;
@@ -790,11 +789,11 @@ public class ObjectIntHashMap implements Cloneable, Serializable {
return false;
}
- public final int hashCode() {
+ public int hashCode() {
return this.hash ^ value;
}
- public final String toString() {
+ public String toString() {
return getKey() + "=" + getValue();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java b/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
index 6324823..3e56801 100644
--- a/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
+++ b/geode-core/src/main/java/org/apache/geode/compression/SnappyCompressor.java
@@ -39,7 +39,7 @@ public class SnappyCompressor implements Compressor, Serializable {
*
* @deprecated As of Geode 1.0, getDefaultInstance is deprecated. Use constructor instead.
*/
- public static final SnappyCompressor getDefaultInstance() {
+ public static SnappyCompressor getDefaultInstance() {
return new SnappyCompressor();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
index 007a990..ce66057 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
@@ -200,7 +200,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @param debug a boolean used to enable or disable debug mode.
* @see #isDebugging()
*/
- public final void setDebug(final boolean debug) {
+ public void setDebug(final boolean debug) {
this.debug = debug;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index 68aa9db..12c5c21 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -288,7 +288,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
*
* @return a reference to the Locator.
*/
- final InternalLocator getLocator() {
+ InternalLocator getLocator() {
return this.locator;
}
@@ -300,7 +300,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getBindAddressAsString()
* @see #getPortAsString()
*/
- public final String getId() {
+ public String getId() {
return LocatorState.getBindAddressAsString(this).concat("[")
.concat(LocatorState.getPortAsString(this)).concat("]");
}
@@ -1510,7 +1510,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
return this;
}
- final boolean isBindAddressSpecified() {
+ boolean isBindAddressSpecified() {
return (getBindAddress() != null);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index acd5e8a..a6d3064 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -328,7 +328,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @return a reference to the Cache created by the GemFire Server start operation.
* @see org.apache.geode.cache.Cache
*/
- final Cache getCache() {
+ Cache getCache() {
if (this.cache != null) {
boolean isReconnecting = this.cache.isReconnecting();
if (isReconnecting) {
@@ -348,7 +348,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @return a CacheConfig object with additional GemFire Cache configuration meta-data used on
* startup to configure the Cache.
*/
- public final CacheConfig getCacheConfig() {
+ public CacheConfig getCacheConfig() {
final CacheConfig copy = new CacheConfig();
copy.setDeclarativeConfig(this.cacheConfig);
return copy;
@@ -362,7 +362,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @see #getServerBindAddressAsString()
* @see #getServerPortAsString()
*/
- public final String getId() {
+ public String getId() {
final StringBuilder buffer = new StringBuilder(ServerState.getServerBindAddressAsString(this));
final String serverPort = ServerState.getServerPortAsString(this);
@@ -899,7 +899,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* determined by the running flag and a connection to the distributed system (GemFire
* cluster).
*/
- final boolean isWaiting(final Cache cache) {
+ boolean isWaiting(final Cache cache) {
// return (isRunning() && !getCache().isClosed());
return (isRunning() && (cache.getDistributedSystem().isConnected() || cache.isReconnecting()));
}
@@ -952,7 +952,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @param cache the Cache to which the server will be added.
* @throws IOException if the Cache server fails to start due to IO error.
*/
- final void startCacheServer(final Cache cache) throws IOException {
+ void startCacheServer(final Cache cache) throws IOException {
if (isDefaultServerEnabled(cache)) {
final String serverBindAddress =
(getServerBindAddress() == null ? null : getServerBindAddress().getHostAddress());
@@ -1894,7 +1894,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
*
* @return a boolean indicating if help was enabled.
*/
- protected final boolean isHelping() {
+ protected boolean isHelping() {
return Boolean.TRUE.equals(getHelp());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
index 4eb9888..0acc6c2 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.distributed.internal;
import org.apache.geode.CancelException;
@@ -37,7 +36,14 @@ import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -57,7 +63,6 @@ import java.util.concurrent.atomic.AtomicInteger;
* A primary design goal of this class is scalability: the footprint must be kept to a minimum as
* the number of instances grows across a growing number of members in the distributed system.
*
- *
* @since GemFire 3.0
*/
public class DistributionAdvisor {
@@ -242,7 +247,7 @@ public class DistributionAdvisor {
return advisor;
}
- protected final void initialize() {
+ protected void initialize() {
subInit();
getDistributionManager().addMembershipListener(this.ml);
}
@@ -1581,7 +1586,7 @@ public class DistributionAdvisor {
*
* @since GemFire 5.0
*/
- public final InternalDistributedMember getDistributedMember() {
+ public InternalDistributedMember getDistributedMember() {
return this.peerMemberId;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index f4e547f..029e637 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -14,16 +14,33 @@
*/
package org.apache.geode.distributed.internal;
-import org.apache.geode.*;
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.CancelException;
+import org.apache.geode.ForcedDisconnectException;
+import org.apache.geode.IncompatibleSystemException;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.InvalidDeltaException;
+import org.apache.geode.SystemConnectException;
+import org.apache.geode.SystemFailure;
+import org.apache.geode.ToDataException;
import org.apache.geode.admin.GemFireHealthConfig;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
import org.apache.geode.distributed.Locator;
import org.apache.geode.distributed.Role;
import org.apache.geode.distributed.internal.locks.ElderState;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.distributed.internal.membership.DistributedMembershipListener;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.distributed.internal.membership.MemberFactory;
+import org.apache.geode.distributed.internal.membership.MembershipManager;
+import org.apache.geode.distributed.internal.membership.NetView;
import org.apache.geode.i18n.StringId;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.NanoTimer;
+import org.apache.geode.internal.OSProcess;
+import org.apache.geode.internal.SetUtils;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.admin.remote.AdminConsoleDisconnectMessage;
import org.apache.geode.internal.admin.remote.RemoteGfManagerAgent;
import org.apache.geode.internal.admin.remote.RemoteTransportConfig;
@@ -42,11 +59,31 @@ import org.apache.geode.internal.tcp.ReenteredConnectException;
import org.apache.geode.internal.util.concurrent.StoppableReentrantLock;
import org.apache.logging.log4j.Logger;
-import java.io.*;
+import java.io.NotSerializableException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
/**
* The <code>DistributionManager</code> uses a {@link MembershipManager} to distribute
@@ -3355,9 +3392,8 @@ public class DistributionManager implements DM {
/**
* Returns the executor for the given type of processor.
- *
*/
- public final Executor getExecutor(int processorType, InternalDistributedMember sender) {
+ public Executor getExecutor(int processorType, InternalDistributedMember sender) {
switch (processorType) {
case STANDARD_EXECUTOR:
return getThreadPool();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
index 403b420..bf11f7a 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java
@@ -56,8 +56,6 @@ import org.apache.geode.internal.util.Breadcrumbs;
* sequentialness/thread requirements of a message, extend DistributionMessage and implement
* getExecutor().
* </P>
- *
- *
*/
public abstract class DistributionMessage implements DataSerializableFixedID, Cloneable {
@@ -135,7 +133,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
* Get the next bit mask position while checking that the value should not exceed given maximum
* value.
*/
- protected static final int getNextBitMask(int mask, final int maxValue) {
+ protected static int getNextBitMask(int mask, final int maxValue) {
mask <<= 1;
if (mask > maxValue) {
Assert.fail("exhausted bit flags with all available bits: 0x" + Integer.toHexString(mask)
@@ -158,7 +156,7 @@ public abstract class DistributionMessage implements DataSerializableFixedID, Cl
this.doDecMessagesBeingReceived = v;
}
- public final void setReplySender(ReplySender acker) {
+ public void setReplySender(ReplySender acker) {
this.acker = acker;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
index 7e87c8c..d93487d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ReplyProcessor21.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.distributed.internal;
import org.apache.geode.CancelCriterion;
@@ -34,7 +33,12 @@ import org.apache.geode.internal.util.Breadcrumbs;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
import org.apache.logging.log4j.Logger;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* This class processes responses to {@link DistributionMessage}s. It handles a the generic case of
@@ -69,8 +73,6 @@ import java.util.*;
* <p>
*
* @see MessageWithReply
- *
- *
* @since GemFire 2.1
*/
public class ReplyProcessor21 implements MembershipListener {
@@ -852,7 +854,7 @@ public class ReplyProcessor21 implements MembershipListener {
* @throws InternalGemFireException if ack-threshold was exceeded and system property
* "ack-threshold-exception" is set to true
*/
- public final void waitForRepliesUninterruptibly() throws ReplyException {
+ public void waitForRepliesUninterruptibly() throws ReplyException {
waitForRepliesUninterruptibly(0);
}
@@ -929,7 +931,7 @@ public class ReplyProcessor21 implements MembershipListener {
}
/** do processing required when finished */
- protected final void finished() {
+ protected void finished() {
boolean isDone = false;
synchronized (this) {
if (!this.done) { // make sure only called once
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
index 101ee63..7bb2de9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal;
import static org.apache.geode.distributed.ConfigurationProperties.*;
@@ -82,7 +81,7 @@ public abstract class AbstractConfig implements Config {
* all values.
*/
@Override
- public final String toString() {
+ public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java b/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
index ae28120..98b1b44 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/HeapDataOutputStream.java
@@ -22,7 +22,11 @@ import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.tcp.ByteBufferInputStream.ByteSource;
import org.apache.logging.log4j.Logger;
-import java.io.*;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UTFDataFormatException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
@@ -35,21 +39,21 @@ import java.util.LinkedList;
* ByteArrayOutputStream.
* <p>
* This class is not thread safe
+ * <p>
+ * Added boolean flag that when turned on will throw an exception instead of allocating a new
+ * buffer. The exception is a BufferOverflowException thrown from expand, and will restore the
+ * position to the point at which the flag was set with the disallowExpansion method.
*
- * @since GemFire 5.0.2
- *
- *
+ * Usage Model: boolean succeeded = true; stream.disallowExpansion(); try {
+ * DataSerializer.writeObject(obj, stream); } catch (BufferOverflowException e) { succeeded = false;
+ * }
*
- * Added boolean flag that when turned on will throw an exception instead of allocating a new
- * buffer. The exception is a BufferOverflowException thrown from expand, and will restore
- * the position to the point at which the flag was set with the disallowExpansion method.
- * Usage Model: boolean succeeded = true; stream.disallowExpansion(); try {
- * DataSerializer.writeObject(obj, stream); } catch (BufferOverflowException e) { succeeded =
- * false; }
+ * @since GemFire 5.0.2
*/
public class HeapDataOutputStream extends OutputStream
implements ObjToByteArraySerializer, VersionedDataStream, ByteBufferWriter {
private static final Logger logger = LogService.getLogger();
+
ByteBuffer buffer;
protected LinkedList<ByteBuffer> chunks = null;
protected int size = 0;
@@ -163,7 +167,7 @@ public class HeapDataOutputStream extends OutputStream
* {@inheritDoc}
*/
@Override
- public final Version getVersion() {
+ public Version getVersion() {
return this.version;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java b/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
index 17894ad..a187c65 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/ObjIdConcurrentMap.java
@@ -12,22 +12,23 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal;
-/*
- * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the
- * public domain, as explained at http://creativecommons.org/licenses/publicdomain
- */
-
-import java.util.concurrent.locks.*;
-import java.util.*;
-import java.io.Serializable;
import java.io.IOException;
+import java.io.Serializable;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.concurrent.locks.ReentrantLock;
/**
+ * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the
+ * public domain, as explained at http://creativecommons.org/licenses/publicdomain
+ *
+ * <p>
* A hash table supporting full concurrency of retrievals and adjustable expected concurrency for
* updates. This class obeys the same functional specification as {@link java.util.Hashtable}, and
* includes versions of methods corresponding to each method of <tt>Hashtable</tt>. However, even
@@ -171,7 +172,7 @@ public class ObjIdConcurrentMap<V> /* extends AbstractMap<K, V> */
* @param hash the hash code for the key
* @return the segment
*/
- final Segment<V> segmentFor(int hash) {
+ Segment<V> segmentFor(int hash) {
return segments[(hash >>> segmentShift) & segmentMask];
}
@@ -1005,7 +1006,7 @@ public class ObjIdConcurrentMap<V> /* extends AbstractMap<K, V> */
return hasNext();
}
- final void advance() {
+ void advance() {
if (nextEntry != null && (nextEntry = nextEntry.next) != null)
return;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java b/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
index 7faebe9..83e1422 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SharedLibrary.java
@@ -222,7 +222,7 @@ public class SharedLibrary {
* @return returns a boolean indicating if the 64bit native library was loaded.
* @since GemFire 5.1
*/
- public final static boolean getIs64Bit() {
+ public static boolean getIs64Bit() {
return PureJavaMode.is64Bit();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
index 16227d2..bd6b60a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java
@@ -435,7 +435,7 @@ public class SystemTimer {
* Does debug logging, catches critical errors, then delegates to {@link #run2()}
*/
@Override
- final public void run() {
+ public void run() {
final boolean isDebugEnabled = logger.isTraceEnabled();
if (isDebugEnabled) {
logger.trace("SystemTimer.MyTask: starting {}", this);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
index 81011d3..1958a85 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractDiskRegion.java
@@ -14,16 +14,6 @@
*/
package org.apache.geode.internal.cache;
-import java.io.PrintStream;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.logging.log4j.Logger;
-
import org.apache.geode.cache.EvictionAction;
import org.apache.geode.cache.EvictionAlgorithm;
import org.apache.geode.compression.Compressor;
@@ -42,19 +32,25 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap;
+import org.apache.logging.log4j.Logger;
+
+import java.io.PrintStream;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
import joptsimple.internal.Strings;
/**
* Code shared by both DiskRegion and RecoveredDiskRegion.
*
- *
* @since GemFire prPersistSprint2
*/
public abstract class AbstractDiskRegion implements DiskRegionView {
private static final Logger logger = LogService.getLogger();
- ////////////////////// Instance Fields ///////////////////////
-
private final DiskStoreImpl ds;
private final long id;
private long clearOplogEntryId = DiskStoreImpl.INVALID_ID;
@@ -235,11 +231,9 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
this.offHeap = drv.getOffHeap();
}
- ////////////////////// Instance Methods //////////////////////
-
public abstract String getName();
- public final DiskStoreImpl getDiskStore() {
+ public DiskStoreImpl getDiskStore() {
return this.ds;
}
@@ -380,15 +374,12 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
return PartitionedRegionHelper.getPRPath(bn);
}
-
-
private PersistentMemberID myInitializingId = null;
private PersistentMemberID myInitializedId = null;
private final CopyOnWriteHashSet<PersistentMemberID> onlineMembers;
private final CopyOnWriteHashSet<PersistentMemberID> offlineMembers;
private final CopyOnWriteHashSet<PersistentMemberID> equalMembers;
-
public PersistentMemberID addMyInitializingPMID(PersistentMemberID pmid) {
PersistentMemberID result = this.myInitializingId;
this.myInitializingId = pmid;
@@ -905,7 +896,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
public void dumpMetadata() {
String name = getName();
- // TODO - DAN - make this a flag
+ // TODO: make this a flag
// if (isBucket() && !DiskStoreImpl.TRACE_RECOVERY) {
// name = getPrName();
// }
@@ -976,7 +967,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
*
* @return an instance of BytesAndBits or Token.REMOVED_PHASE1
*/
- public final Object getRaw(DiskId id) {
+ public Object getRaw(DiskId id) {
this.acquireReadLock();
try {
return getDiskStore().getRaw(this, id);
@@ -1047,7 +1038,7 @@ public abstract class AbstractDiskRegion implements DiskRegionView {
@Override
public void oplogRecovered(long oplogId) {
- // do nothing. Overriden in ExportDiskRegion
+ // do nothing. Overridden in ExportDiskRegion
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
index bcaa0d0..988be0a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractLRURegionMap.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.util.Iterator;
@@ -50,8 +49,6 @@ import org.apache.geode.internal.size.ReflectionSingleObjectSizer;
* Abstract implementation of {@link RegionMap} that adds LRU behaviour.
*
* @since GemFire 3.5.1
- *
- *
*/
public abstract class AbstractLRURegionMap extends AbstractRegionMap {
private static final Logger logger = LogService.getLogger();
@@ -263,7 +260,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
}
/** unsafe audit code. */
- public final void audit() {
+ public void audit() {
if (logger.isTraceEnabled(LogMarker.LRU)) {
logger.trace(LogMarker.LRU, "Size of LRUMap = {}", sizeInVM());
}
@@ -353,7 +350,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
*
* @param delta Description of the Parameter
*/
- protected final void changeTotalEntrySize(int delta) {
+ protected void changeTotalEntrySize(int delta) {
if (_isOwnerALocalRegion()) {
if (_getOwner() instanceof BucketRegion) {
BucketRegion bucketRegion = (BucketRegion) _getOwner();
@@ -577,7 +574,7 @@ public abstract class AbstractLRURegionMap extends AbstractRegionMap {
return resourceManager.getMemoryMonitor(offheap).getState().isEviction() && this.sizeInVM() > 0;
}
- public final int centralizedLruUpdateCallback() {
+ public int centralizedLruUpdateCallback() {
final boolean isDebugEnabled_LRU = logger.isTraceEnabled(LogMarker.LRU);
int evictedBytes = 0;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
index 866ff03..bfeb941 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntry.java
@@ -35,7 +35,7 @@ public abstract class AbstractOplogDiskRegionEntry extends AbstractDiskRegionEnt
abstract void setDiskId(RegionEntry oldRe);
@Override
- public final void removePhase1(LocalRegion r, boolean isClear) throws RegionClearedException {
+ public void removePhase1(LocalRegion r, boolean isClear) throws RegionClearedException {
synchronized (this) {
Helper.removeFromDisk(this, r, isClear);
_removePhase1();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index ac5fb37..b7cd199 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -1529,7 +1529,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
*
* @since GemFire 5.0
*/
- final boolean isAllEvents() {
+ boolean isAllEvents() {
return getDataPolicy().withReplication()
|| getSubscriptionAttributes().getInterestPolicy().isAll();
}
@@ -1787,7 +1787,7 @@ public abstract class AbstractRegion implements Region, RegionAttributes, Attrib
return this.cache;
}
- public final long cacheTimeMillis() {
+ public long cacheTimeMillis() {
return this.cache.getInternalDistributedSystem().getClock().cacheTimeMillis();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
index 5dcf3bc..a1b4a9d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java
@@ -3768,7 +3768,7 @@ public abstract class AbstractRegionMap implements RegionMap {
}
/** removes a tombstone that has expired locally */
- public final boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction,
+ public boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction,
boolean isScheduledTombstone) {
boolean result = false;
int destroyedVersion = version.getEntryVersion();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
index 04a48d0..0c58963 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
@@ -71,7 +71,6 @@ import org.apache.geode.internal.util.StopWatch;
* Specialized {@link CacheDistributionAdvisor} for {@link BucketRegion BucketRegions}. The
* <code>BucketAdvisor</code> is owned by a {@link ProxyBucketRegion} and may outlive a
* <code>BucketRegion</code>.
- *
*/
@SuppressWarnings("synthetic-access")
public class BucketAdvisor extends CacheDistributionAdvisor {
@@ -1211,7 +1210,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*
* @return the member or null if no primary exists
*/
- public final InternalDistributedMember basicGetPrimaryMember() {
+ public InternalDistributedMember basicGetPrimaryMember() {
return (InternalDistributedMember) this.primaryMember.get();
}
@@ -1882,7 +1881,7 @@ public class BucketAdvisor extends CacheDistributionAdvisor {
*
* @return current number of hosts of this bucket ; -1 if there are no hosts
*/
- public final int getBucketRedundancy() {
+ public int getBucketRedundancy() {
return redundancy;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
index ad3f976..20cbd28 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyOperation.java
@@ -12,14 +12,11 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.CacheEvent;
@@ -36,10 +33,9 @@ import org.apache.geode.internal.offheap.annotations.Retained;
/**
* Handles distribution messaging for destroying an entry in a region.
- *
- *
*/
public class DestroyOperation extends DistributedCacheOperation {
+
/** Creates a new instance of DestroyOperation */
public DestroyOperation(EntryEventImpl event) {
super(event);
@@ -116,8 +112,7 @@ public class DestroyOperation extends DistributedCacheOperation {
@Override
@Retained
- protected final InternalCacheEvent createEvent(DistributedRegion rgn)
- throws EntryNotFoundException {
+ protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException {
EntryEventImpl ev = createEntryEvent(rgn);
boolean evReturned = false;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
index 6411353..4d85578 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistPeerTXStateStub.java
@@ -36,10 +36,9 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* 1. It forwards TX operations to primary or a selected replica (in case of RR) for each op </br>
* 2.It also records those transactional operations in order to send those to
* secondaries/replicas(in one batch) at commit time.
- *
- *
*/
public class DistPeerTXStateStub extends PeerTXStateStub implements DistTXCoordinatorInterface {
+
private ArrayList<DistTxEntryEvent> primaryTransactionalOperations = null;
private ArrayList<DistTxEntryEvent> secondaryTransactionalOperations = null;
private DistTXPrecommitMessage precommitDistTxMsg = null;
@@ -108,7 +107,7 @@ public class DistPeerTXStateStub extends PeerTXStateStub implements DistTXCoordi
}
@Override
- public final ArrayList<DistTxEntryEvent> getPrimaryTransactionalOperations()
+ public ArrayList<DistTxEntryEvent> getPrimaryTransactionalOperations()
throws UnsupportedOperationInTransactionException {
return primaryTransactionalOperations;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index 6c33c65..a2d2e9d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
@@ -750,7 +750,7 @@ public abstract class DistributedCacheOperation {
// nothing to do here - see UpdateMessage
}
- protected final void waitForAckIfNeeded(CacheOperationMessage msg,
+ protected void waitForAckIfNeeded(CacheOperationMessage msg,
Map<InternalDistributedMember, PersistentMemberID> persistentIds) {
if (this.processor == null) {
return;
@@ -1068,7 +1068,7 @@ public abstract class DistributedCacheOperation {
}
@Override
- protected final void process(final DistributionManager dm) {
+ protected void process(final DistributionManager dm) {
Throwable thr = null;
boolean sendReply = true;
@@ -1481,7 +1481,7 @@ public abstract class DistributedCacheOperation {
}
}
- public final boolean supportsDirectAck() {
+ public boolean supportsDirectAck() {
return this.directAck;
}
@@ -1518,7 +1518,7 @@ public abstract class DistributedCacheOperation {
this.hasOldValue = true;
}
- protected final boolean _mayAddToMultipleSerialGateways(DistributionManager dm) {
+ protected boolean _mayAddToMultipleSerialGateways(DistributionManager dm) {
int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.ANY_INIT);
try {
LocalRegion lr = getLocalRegionForProcessing(dm);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
index c26cd56..4dcb0b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedPutAllOperation.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
@@ -261,7 +260,7 @@ public class DistributedPutAllOperation extends AbstractUpdateOperation {
}
}
- public final EntryEventImpl getBaseEvent() {
+ public EntryEventImpl getBaseEvent() {
return getEvent();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
index 485835b..650fe2a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegion.java
@@ -888,7 +888,7 @@ public class DistributedRegion extends LocalRegion implements CacheDistributionA
}
@Override
- public final Object validatedDestroy(Object key, EntryEventImpl event)
+ public Object validatedDestroy(Object key, EntryEventImpl event)
throws TimeoutException, EntryNotFoundException, CacheWriterException {
Lock dlock = this.getDistributedLockIfGlobal(key);
try {
[12/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
index 1700ccd..ea3f8d6 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
@@ -95,7 +95,7 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest
}
}
- private final void getAvailableCacheElseCreateCache() {
+ private void getAvailableCacheElseCreateCache() {
synchronized (ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.class) {
try {
Cache newCache = GemFireCacheImpl.getInstance();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
index cfd75ba..5a5c80d 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
@@ -49,7 +49,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* Invokes the {@link #run2} method and will wrap any {@link CacheException} thrown by
* <code>run2</code> in a {@link CacheSerializableRunnableException}.
*/
- public final void run() {
+ public void run() {
try {
if (args == null) {
run2();
@@ -68,7 +68,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* repeat the {@link #run} method until it either succeeds or repeatTimeoutMs milliseconds have
* passed. The AssertionError is only thrown to the caller if the last run still throws it.
*/
- public final void runRepeatingIfNecessary(long repeatTimeoutMs) {
+ public void runRepeatingIfNecessary(long repeatTimeoutMs) {
long start = System.currentTimeMillis();
AssertionError lastErr = null;
do {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
index db92dc8..3b56748 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
@@ -124,12 +124,12 @@ public abstract class RegionTestCase extends JUnit4CacheTestCase {
*
* @see #getRegionAttributes
*/
- protected final Region createRegion(String name) throws CacheException {
+ protected Region createRegion(String name) throws CacheException {
return createRegion(name, getRegionAttributes());
}
- protected final Region createRootRegion() throws CacheException {
+ protected Region createRootRegion() throws CacheException {
return createRootRegion(getRegionAttributes());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
index c8a629c..e801392 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
@@ -399,7 +399,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
rgn2.destroyRegion();
}
- static final void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
+ static void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
((TXStateProxyImpl) txp).forceLocalBootstrap();
TXState tx = (TXState) ((TXStateProxyImpl) txp).getRealDeal(null, null);
assertEquals(9, cbSensors.length);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
index 37f67e8..3004ea8 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
@@ -77,7 +77,7 @@ public abstract class TestCacheCallback implements CacheCallback {
return this.isClosed;
}
- public final void close() {
+ public void close() {
this.isClosed = true;
close2();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
index db318d5..b7f811a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
@@ -86,7 +86,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
}
}
- public final void afterCreate(EntryEvent event) {
+ public void afterCreate(EntryEvent event) {
addEvent(event);
try {
afterCreate2(event);
@@ -103,7 +103,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterUpdate(EntryEvent event) {
+ public void afterUpdate(EntryEvent event) {
addEvent(event);
try {
afterUpdate2(event);
@@ -120,7 +120,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterInvalidate(EntryEvent event) {
+ public void afterInvalidate(EntryEvent event) {
addEvent(event);
try {
afterInvalidate2(event);
@@ -137,7 +137,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterDestroy(EntryEvent event) {
+ public void afterDestroy(EntryEvent event) {
afterDestroyBeforeAddEvent(event);
addEvent(event);
try {
@@ -159,7 +159,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionInvalidate(RegionEvent event) {
+ public void afterRegionInvalidate(RegionEvent event) {
addEvent(event);
try {
afterRegionInvalidate2(event);
@@ -176,7 +176,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionDestroy(RegionEvent event) {
+ public void afterRegionDestroy(RegionEvent event) {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
return;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
index d9158a5..8f91515 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
@@ -27,7 +27,7 @@ import org.apache.geode.cache.*;
*/
public abstract class TestCacheLoader extends TestCacheCallback implements CacheLoader {
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
this.invoked = true;
return load2(helper);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
index 95d7f75..ea1ed1a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
@@ -29,7 +29,7 @@ import org.apache.geode.cache.*;
public abstract class TestCacheWriter extends TestCacheCallback implements CacheWriter {
- public final void beforeUpdate(EntryEvent event) throws CacheWriterException {
+ public void beforeUpdate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeUpdate2(event);
@@ -41,13 +41,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeCreate(EntryEvent event) throws CacheWriterException {
+ public void beforeCreate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeCreate2(event);
@@ -62,13 +62,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
/**
* Causes code that uses the old API to not compile
*/
- public final void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy(EntryEvent event) throws CacheWriterException {
+ public void beforeDestroy(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeDestroy2(event);
@@ -80,13 +80,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
@@ -102,14 +102,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy2(RegionEvent event, Object arg)
- throws CacheWriterException {
+ public void beforeRegionDestroy2(RegionEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionClear(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
String s = "Unexpected callback invocation";
throw new UnsupportedOperationException(s);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
index 2b75ccc..d29cb3c 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
@@ -28,7 +28,7 @@ import org.apache.geode.cache.*;
public abstract class TestTransactionListener extends TestCacheCallback
implements TransactionListener {
- public final void afterCommit(TransactionEvent event) {
+ public void afterCommit(TransactionEvent event) {
this.invoked = true;
try {
afterCommit2(event);
@@ -45,7 +45,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
throw new UnsupportedOperationException(s);
}
- public final void afterFailedCommit(TransactionEvent event) {
+ public void afterFailedCommit(TransactionEvent event) {
this.invoked = true;
try {
afterFailedCommit2(event);
@@ -63,7 +63,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
}
- public final void afterRollback(TransactionEvent event) {
+ public void afterRollback(TransactionEvent event) {
this.invoked = true;
try {
afterRollback2(event);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
index 416b459..46d51e8 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
@@ -20,6 +20,9 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import org.apache.commons.lang.StringUtils;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -50,6 +53,13 @@ public class AbstractLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLauncher mockAbstractLauncher = mock(AbstractLauncher.class);
+ mockAbstractLauncher.setDebug(true);
+ verify(mockAbstractLauncher, times(1)).setDebug(true);
+ }
+
+ @Test
public void testIsSet() {
final Properties properties = new Properties();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
index 2a6dfa6..4117d25 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
@@ -58,7 +58,7 @@ public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
index d3aa05b..b50b77a 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
@@ -62,7 +62,7 @@ public abstract class AbstractServerLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 50cea4d..0281a37 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -21,15 +21,16 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
@@ -40,7 +41,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import joptsimple.OptionException;
-
/**
* The LocatorLauncherTest class is a test suite of test cases for testing the contract and
* functionality of launching a GemFire Locator.
@@ -61,9 +61,16 @@ public class LocatorLauncherTest {
@Rule
public final TestName testName = new TestName();
- @Before
- public void setup() {
- DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
+ @Test
+ public void shouldBeMockable() throws Exception {
+ LocatorLauncher mockLocatorLauncher = mock(LocatorLauncher.class);
+ InternalLocator mockInternalLocator = mock(InternalLocator.class);
+
+ when(mockLocatorLauncher.getLocator()).thenReturn(mockInternalLocator);
+ when(mockLocatorLauncher.getId()).thenReturn("ID");
+
+ assertThat(mockLocatorLauncher.getLocator()).isSameAs(mockInternalLocator);
+ assertThat(mockLocatorLauncher.getId()).isEqualTo("ID");
}
@Test(expected = IllegalArgumentException.class)
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index 98f73d8..9611e32 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -15,12 +15,18 @@
package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
@@ -29,6 +35,7 @@ import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.support.DistributedSystemAdapter;
+import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -93,6 +100,29 @@ public class ServerLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ ServerLauncher mockServerLauncher = mock(ServerLauncher.class);
+ Cache mockCache = mock(Cache.class);
+ CacheConfig mockCacheConfig = mock(CacheConfig.class);
+
+ when(mockServerLauncher.getCache()).thenReturn(mockCache);
+ when(mockServerLauncher.getCacheConfig()).thenReturn(mockCacheConfig);
+ when(mockServerLauncher.getId()).thenReturn("ID");
+ when(mockServerLauncher.isWaiting(eq(mockCache))).thenReturn(true);
+ when(mockServerLauncher.isHelping()).thenReturn(true);
+
+ mockServerLauncher.startCacheServer(mockCache);
+
+ verify(mockServerLauncher, times(1)).startCacheServer(mockCache);
+
+ assertThat(mockServerLauncher.getCache()).isSameAs(mockCache);
+ assertThat(mockServerLauncher.getCacheConfig()).isSameAs(mockCacheConfig);
+ assertThat(mockServerLauncher.getId()).isSameAs("ID");
+ assertThat(mockServerLauncher.isWaiting(mockCache)).isTrue();
+ assertThat(mockServerLauncher.isHelping()).isTrue();
+ }
+
+ @Test
public void testParseCommand() {
Builder builder = new Builder();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
new file mode 100644
index 0000000..ab5124a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionAdvisor mockDistributionAdvisor = mock(DistributionAdvisor.class);
+ mockDistributionAdvisor.initialize();
+ verify(mockDistributionAdvisor, times(1)).initialize();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
new file mode 100644
index 0000000..5e37c18
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.concurrent.Executor;
+
+@Category(UnitTest.class)
+public class DistributionManagerTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ Executor mockExecutor = mock(Executor.class);
+ when(mockDistributionManager.getExecutor(anyInt(), eq(mockInternalDistributedMember)))
+ .thenReturn(mockExecutor);
+ assertThat(mockDistributionManager.getExecutor(1, mockInternalDistributedMember))
+ .isSameAs(mockExecutor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
new file mode 100644
index 0000000..df6e7c5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionMessage mockDistributionMessage = mock(DistributionMessage.class);
+ ReplySender mockReplySender = mock(ReplySender.class);
+
+ mockDistributionMessage.setReplySender(mockReplySender);
+
+ verify(mockDistributionMessage, times(1)).setReplySender(mockReplySender);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
new file mode 100644
index 0000000..224e845
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ReplyProcessor21Test {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ReplyProcessor21 mockReplyProcessor21 = mock(ReplyProcessor21.class);
+
+ mockReplyProcessor21.waitForRepliesUninterruptibly();
+ mockReplyProcessor21.finished();
+
+ verify(mockReplyProcessor21, times(1)).waitForRepliesUninterruptibly();
+ verify(mockReplyProcessor21, times(1)).finished();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
new file mode 100644
index 0000000..88105d3
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractConfigTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractConfig mockAbstractConfig = mock(AbstractConfig.class);
+ when(mockAbstractConfig.toString()).thenReturn("STRING");
+ assertThat(mockAbstractConfig.toString()).isEqualTo("STRING");
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
index 2f853db..12e20c7 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
@@ -3283,7 +3283,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newDataSerializer(DataSerializer ds) {
+ public void newDataSerializer(DataSerializer ds) {
this.invoked = true;
try {
newDataSerializer2(ds);
@@ -3302,7 +3302,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newInstantiator(Instantiator instantiator) {
+ public void newInstantiator(Instantiator instantiator) {
this.invoked = true;
try {
newInstantiator2(instantiator);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
new file mode 100644
index 0000000..fa79ff2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class HeapDataOutputStreamTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ HeapDataOutputStream mockHeapDataOutputStream = mock(HeapDataOutputStream.class);
+ Version mockVersion = mock(Version.class);
+ when(mockHeapDataOutputStream.getVersion()).thenReturn(mockVersion);
+ assertThat(mockHeapDataOutputStream.getVersion()).isEqualTo(mockVersion);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
new file mode 100644
index 0000000..4d9f480
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.ObjIdConcurrentMap.Segment;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ObjIdConcurrentMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ObjIdConcurrentMap mockObjIdConcurrentMap = mock(ObjIdConcurrentMap.class);
+ Segment mockSegment = mock(Segment.class);
+
+ when(mockObjIdConcurrentMap.segmentFor(anyInt())).thenReturn(mockSegment);
+
+ assertThat(mockObjIdConcurrentMap.segmentFor(0)).isEqualTo(mockSegment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
new file mode 100644
index 0000000..d994fe9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractDiskRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractDiskRegion mockAbstractDiskRegion = mock(AbstractDiskRegion.class);
+ DiskStoreImpl mockDiskStoreImpl = mock(DiskStoreImpl.class);
+ DiskId mockDiskId = mock(DiskId.class);
+ Object object = new Object();
+
+ when(mockAbstractDiskRegion.getDiskStore()).thenReturn(mockDiskStoreImpl);
+ when(mockAbstractDiskRegion.getRaw(eq(mockDiskId))).thenReturn(object);
+
+ assertThat(mockAbstractDiskRegion.getDiskStore()).isEqualTo(mockDiskStoreImpl);
+ assertThat(mockAbstractDiskRegion.getRaw(mockDiskId)).isEqualTo(object);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
new file mode 100644
index 0000000..abead95
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractLRURegionMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLRURegionMap mockAbstractLRURegionMap = mock(AbstractLRURegionMap.class);
+
+ when(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).thenReturn(1);
+
+ mockAbstractLRURegionMap.audit();
+ mockAbstractLRURegionMap.changeTotalEntrySize(1);
+
+ verify(mockAbstractLRURegionMap, times(1)).audit();
+ verify(mockAbstractLRURegionMap, times(1)).changeTotalEntrySize(1);
+
+ assertThat(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
new file mode 100644
index 0000000..5043f09
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractOplogDiskRegionEntryTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractOplogDiskRegionEntry mockAbstractOplogDiskRegionEntry =
+ mock(AbstractOplogDiskRegionEntry.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+
+ mockAbstractOplogDiskRegionEntry.removePhase1(mockLocalRegion, true);
+
+ verify(mockAbstractOplogDiskRegionEntry, times(1)).removePhase1(mockLocalRegion, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
index eee588e..60b93a9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
@@ -14,21 +14,46 @@
*/
package org.apache.geode.internal.cache;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyBoolean;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.Operation;
+import org.apache.geode.internal.cache.versions.VersionHolder;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
@Category(UnitTest.class)
public class AbstractRegionMapTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegionMap mockAbstractRegionMap = mock(AbstractRegionMap.class);
+ RegionEntry mockRegionEntry = mock(RegionEntry.class);
+ VersionHolder mockVersionHolder = mock(VersionHolder.class);
+
+ when(mockAbstractRegionMap.removeTombstone(eq(mockRegionEntry), eq(mockVersionHolder),
+ anyBoolean(), anyBoolean())).thenReturn(true);
+
+ assertThat(
+ mockAbstractRegionMap.removeTombstone(mockRegionEntry, mockVersionHolder, true, true))
+ .isTrue();
+ }
+
+ @Test
public void invalidateOfNonExistentRegionThrowsEntryNotFound() {
TestableAbstractRegionMap arm = new TestableAbstractRegionMap();
EntryEventImpl event = createEventForInvalidate(arm.owner);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
new file mode 100644
index 0000000..adbfa02
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegion mockAbstractRegion = mock(AbstractRegion.class);
+ long millis = System.currentTimeMillis();
+
+ when(mockAbstractRegion.isAllEvents()).thenReturn(true);
+ when(mockAbstractRegion.cacheTimeMillis()).thenReturn(millis);
+
+ assertThat(mockAbstractRegion.isAllEvents()).isTrue();
+ assertThat(mockAbstractRegion.cacheTimeMillis()).isEqualTo(millis);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
new file mode 100644
index 0000000..2b17f36
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class BucketAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ BucketAdvisor mockBucketAdvisor = mock(BucketAdvisor.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+
+ when(mockBucketAdvisor.basicGetPrimaryMember()).thenReturn(mockInternalDistributedMember);
+ when(mockBucketAdvisor.getBucketRedundancy()).thenReturn(1);
+
+ assertThat(mockBucketAdvisor.basicGetPrimaryMember()).isEqualTo(mockInternalDistributedMember);
+ assertThat(mockBucketAdvisor.getBucketRedundancy()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
index 3d0be6a..5718055 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
@@ -267,11 +267,11 @@ public class Bug37377DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
return new TestAbstractDiskRegionEntry(r, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return TestAbstractDiskRegionEntry.class;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
index 6dc52ba..1a4e51e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
@@ -305,12 +305,12 @@ public class Bug39079DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
@Override
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
throw new DiskAccessException(new IOException("Test Exception"));
}
@Override
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return getClass();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
new file mode 100644
index 0000000..3e60ef2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CacheOperationMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+
+ when(mockCacheOperationMessage.supportsDirectAck()).thenReturn(true);
+ when(mockCacheOperationMessage._mayAddToMultipleSerialGateways(eq(mockDistributionManager)))
+ .thenReturn(true);
+
+ mockCacheOperationMessage.process(mockDistributionManager);
+
+ verify(mockCacheOperationMessage, times(1)).process(mockDistributionManager);
+
+ assertThat(mockCacheOperationMessage.supportsDirectAck()).isTrue();
+ assertThat(mockCacheOperationMessage._mayAddToMultipleSerialGateways(mockDistributionManager))
+ .isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
new file mode 100644
index 0000000..8ffbdaf
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.DestroyOperation.DestroyMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DestroyMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DestroyMessage mockDestroyOperation = mock(DestroyMessage.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
+
+ when(mockDestroyOperation.createEvent(eq(mockDistributedRegion)))
+ .thenReturn(mockInternalCacheEvent);
+
+ assertThat(mockDestroyOperation.createEvent(mockDistributedRegion))
+ .isEqualTo(mockInternalCacheEvent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
index dd29c74..81747f1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
@@ -240,7 +240,7 @@ public class DiskRegCacheXmlJUnitTest {
}
/** Close the cache */
- private synchronized final void closeCache() {
+ private synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
index 63e6d62..8a99972 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
@@ -120,7 +120,7 @@ public class DiskRegionClearJUnitTest {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
index 913d56d..2d3ac3a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
@@ -175,7 +175,7 @@ public abstract class DiskRegionTestingBase {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
new file mode 100644
index 0000000..f2806fe
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tx.DistTxEntryEvent;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+
+@Category(UnitTest.class)
+public class DistPeerTXStateStubTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistPeerTXStateStub mockDistPeerTXStateStub = mock(DistPeerTXStateStub.class);
+ DistTxEntryEvent mockDistTxEntryEvent = mock(DistTxEntryEvent.class);
+ ArrayList<DistTxEntryEvent> arrayOfDistTxEntryEvents = new ArrayList<>();
+ arrayOfDistTxEntryEvents.add(mockDistTxEntryEvent);
+
+ when(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .thenReturn(arrayOfDistTxEntryEvents);
+
+ assertThat(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .isSameAs(arrayOfDistTxEntryEvents);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
new file mode 100644
index 0000000..cba7c98
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.internal.cache.persistence.PersistentMemberID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Category(UnitTest.class)
+public class DistributedCacheOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedCacheOperation mockDistributedCacheOperation = mock(DistributedCacheOperation.class);
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ Map<InternalDistributedMember, PersistentMemberID> persistentIds = new HashMap<>();
+ when(mockDistributedCacheOperation.supportsDirectAck()).thenReturn(false);
+
+ mockDistributedCacheOperation.waitForAckIfNeeded(mockCacheOperationMessage, persistentIds);
+
+ verify(mockDistributedCacheOperation, times(1)).waitForAckIfNeeded(mockCacheOperationMessage,
+ persistentIds);
+
+ assertThat(mockDistributedCacheOperation.supportsDirectAck()).isFalse();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
new file mode 100644
index 0000000..3d60475
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedPutAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedPutAllOperation mockDistributedPutAllOperation =
+ mock(DistributedPutAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedPutAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedPutAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..7c6aebc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegionFunctionStreamingMessage mockDistributedRegionFunctionStreamingMessage =
+ mock(DistributedRegionFunctionStreamingMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+
+ when(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(eq(mockDistributionManager), eq(mockDistributedRegion)))
+ .thenReturn(true);
+
+ assertThat(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(mockDistributionManager, mockDistributedRegion)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
new file mode 100644
index 0000000..67b0c6c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+ Object returnValue = new Object();
+
+ when(mockDistributedRegion.validatedDestroy(anyObject(), eq(mockEntryEventImpl)))
+ .thenReturn(returnValue);
+
+ assertThat(mockDistributedRegion.validatedDestroy(new Object(), mockEntryEventImpl))
+ .isSameAs(returnValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
new file mode 100644
index 0000000..42780db
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRemoveAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRemoveAllOperation mockDistributedRemoveAllOperation =
+ mock(DistributedRemoveAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedRemoveAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedRemoveAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
new file mode 100644
index 0000000..4bcebda
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ExpiryTaskTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ExpiryTask mockExpiryTask = mock(ExpiryTask.class);
+ mockExpiryTask.run2();
+ verify(mockExpiryTask, times(1)).run2();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
index a24fc5a..d867959 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -22,6 +23,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -38,6 +40,17 @@ import org.apache.geode.test.junit.categories.UnitTest;
public class GemFireCacheImplTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ GemFireCacheImpl mockGemFireCacheImpl = mock(GemFireCacheImpl.class);
+ InternalResourceManager mockInternalResourceManager = mock(InternalResourceManager.class);
+
+ when(mockGemFireCacheImpl.getInternalResourceManager()).thenReturn(mockInternalResourceManager);
+
+ assertThat(mockGemFireCacheImpl.getInternalResourceManager())
+ .isSameAs(mockInternalResourceManager);
+ }
+
+ @Test
public void checkPurgeCCPTimer() {
InternalDistributedSystem ds = Fakes.distributedSystem();
CacheConfig cc = new CacheConfig();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
new file mode 100644
index 0000000..afaa04b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.DistributionAdvisor.ProfileId;
+import org.apache.geode.internal.cache.GridAdvisor.GridProfile;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class GridProfileTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ GridProfile mockGridProfile = mock(GridProfile.class);
+ ProfileId mockProfileId = mock(ProfileId.class);
+ List<Profile> listOfProfiles = new ArrayList<>();
+ listOfProfiles.add(mock(Profile.class));
+
+ when(mockGridProfile.getHost()).thenReturn("HOST");
+ when(mockGridProfile.getPort()).thenReturn(1);
+ when(mockGridProfile.getId()).thenReturn(mockProfileId);
+
+ mockGridProfile.setHost("host");
+ mockGridProfile.setPort(2);
+ mockGridProfile.tellLocalControllers(true, true, listOfProfiles);
+ mockGridProfile.tellLocalBridgeServers(true, true, listOfProfiles);
+
+ verify(mockGridProfile, times(1)).setHost("host");
+ verify(mockGridProfile, times(1)).setPort(2);
+ verify(mockGridProfile, times(1)).tellLocalControllers(true, true, listOfProfiles);
+ verify(mockGridProfile, times(1)).tellLocalBridgeServers(true, true, listOfProfiles);
+
+ assertThat(mockGridProfile.getHost()).isEqualTo("HOST");
+ assertThat(mockGridProfile.getPort()).isEqualTo(1);
+ assertThat(mockGridProfile.getId()).isSameAs(mockProfileId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..b9cb872
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MemberFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ MemberFunctionStreamingMessage mockMemberFunctionStreamingMessage =
+ mock(MemberFunctionStreamingMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .thenReturn(mockInternalDistributedMember);
+ assertThat(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .isSameAs(mockInternalDistributedMember);
+ }
+}
[21/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put65.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put65.java
index d53c89e..581aec6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put65.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put65.java
@@ -63,7 +63,7 @@ public class Put65 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long p_start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long p_start)
throws IOException, InterruptedException {
long start = p_start;
Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
@@ -72,11 +72,11 @@ public class Put65 extends BaseCommand {
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
boolean isDelta = false;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
@@ -84,50 +84,50 @@ public class Put65 extends BaseCommand {
}
// Retrieve the data from the message parts
int idx = 0;
- regionNamePart = msg.getPart(idx++);
+ regionNamePart = clientMessage.getPart(idx++);
Operation operation;
try {
- operation = (Operation) msg.getPart(idx++).getObject();
+ operation = (Operation) clientMessage.getPart(idx++).getObject();
if (operation == null) { // native clients send a null since the op is java-serialized
operation = Operation.UPDATE;
}
} catch (ClassNotFoundException e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- int flags = msg.getPart(idx++).getInt();
+ int flags = clientMessage.getPart(idx++).getInt();
boolean requireOldValue = ((flags & 0x01) == 0x01);
boolean haveExpectedOldValue = ((flags & 0x02) == 0x02);
Object expectedOldValue = null;
if (haveExpectedOldValue) {
try {
- expectedOldValue = msg.getPart(idx++).getObject();
+ expectedOldValue = clientMessage.getPart(idx++).getObject();
} catch (ClassNotFoundException e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
- keyPart = msg.getPart(idx++);
+ keyPart = clientMessage.getPart(idx++);
try {
- isDelta = ((Boolean) msg.getPart(idx).getObject()).booleanValue();
+ isDelta = ((Boolean) clientMessage.getPart(idx).getObject()).booleanValue();
idx += 1;
} catch (Exception e) {
- writeException(msg, MessageType.PUT_DELTA_ERROR, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, MessageType.PUT_DELTA_ERROR, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
// CachePerfStats not available here.
return;
}
- valuePart = msg.getPart(idx++);
- eventPart = msg.getPart(idx++);
- if (msg.getNumberOfParts() > idx) {
- callbackArgPart = msg.getPart(idx++);
+ valuePart = clientMessage.getPart(idx++);
+ eventPart = clientMessage.getPart(idx++);
+ if (clientMessage.getNumberOfParts() > idx) {
+ callbackArgPart = clientMessage.getPart(idx++);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -136,8 +136,8 @@ public class Put65 extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -145,8 +145,8 @@ public class Put65 extends BaseCommand {
if (isDebugEnabled) {
logger.debug(
"{}: Received {}put request ({} bytes) from {} for region {} key {} txId {} posdup: {}",
- servConn.getName(), (isDelta ? " delta " : " "), msg.getPayloadLength(),
- servConn.getSocketString(), regionName, key, msg.getTransactionId(), msg.isRetry());
+ serverConnection.getName(), (isDelta ? " delta " : " "), clientMessage.getPayloadLength(),
+ serverConnection.getSocketString(), regionName, key, clientMessage.getTransactionId(), clientMessage.isRetry());
}
// Process the put request
@@ -154,27 +154,27 @@ public class Put65 extends BaseCommand {
if (key == null) {
String putMsg = " The input key for the put request is null";
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
}
if (regionName == null) {
String putMsg = " The input region name for the put request is null";
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
}
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during put request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -182,11 +182,11 @@ public class Put65 extends BaseCommand {
// Invalid to 'put' a null value in an existing key
String putMsg = " Attempted to put a null value for existing key " + key;
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -195,12 +195,12 @@ public class Put65 extends BaseCommand {
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
EventIDHolder clientEvent =
- new EventIDHolder(new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId));
+ new EventIDHolder(new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId));
Breadcrumbs.setEventId(clientEvent.getEventId());
// msg.isRetry might be set by v7.0 and later clients
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// if (logger.isDebugEnabled()) {
// logger.debug("DEBUG: encountered isRetry in Put65");
// }
@@ -226,13 +226,13 @@ public class Put65 extends BaseCommand {
}
boolean isObject = valuePart.isObject();
boolean isMetaRegion = region.isUsedForMetaRegion();
- msg.setMetaRegion(isMetaRegion);
+ clientMessage.setMetaRegion(isMetaRegion);
this.securityService.authorizeRegionWrite(regionName, key.toString());
AuthorizeRequest authzRequest = null;
if (!isMetaRegion) {
- authzRequest = servConn.getAuthzRequest();
+ authzRequest = serverConnection.getAuthzRequest();
}
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
@@ -257,7 +257,7 @@ public class Put65 extends BaseCommand {
// to be publicly accessible.
if (operation == Operation.PUT_IF_ABSENT) {
// try {
- if (msg.isRetry() && clientEvent.getVersionTag() != null) {
+ if (clientMessage.isRetry() && clientEvent.getVersionTag() != null) {
// bug #46590 the operation was successful the last time since it
// was applied to the cache, so return success and the recovered
// version tag
@@ -267,16 +267,16 @@ public class Put65 extends BaseCommand {
}
// invoke basicBridgePutIfAbsent anyway to ensure that the event is distributed to all
// servers - bug #51664
- region.basicBridgePutIfAbsent(key, value, isObject, callbackArg, servConn.getProxyID(),
+ region.basicBridgePutIfAbsent(key, value, isObject, callbackArg, serverConnection.getProxyID(),
true, clientEvent);
oldValue = null;
} else {
oldValue = region.basicBridgePutIfAbsent(key, value, isObject, callbackArg,
- servConn.getProxyID(), true, clientEvent);
+ serverConnection.getProxyID(), true, clientEvent);
}
sendOldValue = true;
oldValueIsObject = true;
- Version clientVersion = servConn.getClientVersion();
+ Version clientVersion = serverConnection.getClientVersion();
if (oldValue instanceof CachedDeserializable) {
oldValue = ((CachedDeserializable) oldValue).getSerializedValue();
} else if (oldValue instanceof byte[]) {
@@ -299,7 +299,7 @@ public class Put65 extends BaseCommand {
} else if (operation == Operation.REPLACE) {
// try {
if (requireOldValue) { // <V> replace(<K>, <V>)
- if (msg.isRetry() && clientEvent.isConcurrencyConflict()
+ if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict()
&& clientEvent.getVersionTag() != null) {
if (isDebugEnabled) {
logger.debug("replace(k,v) operation was successful last time with version {}",
@@ -307,10 +307,10 @@ public class Put65 extends BaseCommand {
}
}
oldValue = region.basicBridgeReplace(key, value, isObject, callbackArg,
- servConn.getProxyID(), true, clientEvent);
+ serverConnection.getProxyID(), true, clientEvent);
sendOldValue = !clientEvent.isConcurrencyConflict();
oldValueIsObject = true;
- Version clientVersion = servConn.getClientVersion();
+ Version clientVersion = serverConnection.getClientVersion();
if (oldValue instanceof CachedDeserializable) {
oldValue = ((CachedDeserializable) oldValue).getSerializedValue();
} else if (oldValue instanceof byte[]) {
@@ -330,8 +330,8 @@ public class Put65 extends BaseCommand {
} else { // boolean replace(<K>, <V>, <V>) {
boolean didPut;
didPut = region.basicBridgeReplace(key, expectedOldValue, value, isObject, callbackArg,
- servConn.getProxyID(), true, clientEvent);
- if (msg.isRetry() && clientEvent.getVersionTag() != null) {
+ serverConnection.getProxyID(), true, clientEvent);
+ if (clientMessage.isRetry() && clientEvent.getVersionTag() != null) {
if (isDebugEnabled) {
logger.debug("replace(k,v,v) operation was successful last time with version {}",
clientEvent.getVersionTag());
@@ -356,9 +356,9 @@ public class Put65 extends BaseCommand {
// Create the null entry. Since the value is null, the value of the
// isObject
// the true after null doesn't matter and is not used.
- result = region.basicBridgeCreate(key, null, true, callbackArg, servConn.getProxyID(), true,
+ result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true,
clientEvent, false);
- if (msg.isRetry() && clientEvent.isConcurrencyConflict()
+ if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict()
&& clientEvent.getVersionTag() != null) {
result = true;
if (isDebugEnabled) {
@@ -372,16 +372,16 @@ public class Put65 extends BaseCommand {
if (isDelta) {
delta = valuePart.getSerializedForm();
}
- TXManagerImpl txMgr = (TXManagerImpl) servConn.getCache().getCacheTransactionManager();
+ TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
// bug 43068 - use create() if in a transaction and op is CREATE
if (txMgr.getTXState() != null && operation.isCreate()) {
result = region.basicBridgeCreate(key, (byte[]) value, isObject, callbackArg,
- servConn.getProxyID(), true, clientEvent, true);
+ serverConnection.getProxyID(), true, clientEvent, true);
} else {
result = region.basicBridgePut(key, value, delta, isObject, callbackArg,
- servConn.getProxyID(), true, clientEvent);
+ serverConnection.getProxyID(), true, clientEvent);
}
- if (msg.isRetry() && clientEvent.isConcurrencyConflict()
+ if (clientMessage.isRetry() && clientEvent.isConcurrencyConflict()
&& clientEvent.getVersionTag() != null) {
if (isDebugEnabled) {
logger.debug("put(k,v) operation was successful last time with version {}",
@@ -391,46 +391,46 @@ public class Put65 extends BaseCommand {
}
}
if (result) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} else {
- String message = servConn.getName() + ": Failed to put entry for region " + regionName
- + " key " + key + " value " + valuePart;
+ String message = serverConnection.getName() + ": Failed to put entry for region " + regionName
+ + " key " + key + " value " + valuePart;
if (isDebugEnabled) {
logger.debug(message);
}
throw new Exception(message);
}
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, re, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (InvalidDeltaException ide) {
logger.info(LocalizedMessage.create(
LocalizedStrings.UpdateOperation_ERROR_APPLYING_DELTA_FOR_KEY_0_OF_REGION_1,
new Object[] {key, regionName}));
- writeException(msg, MessageType.PUT_DELTA_ERROR, ide, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, MessageType.PUT_DELTA_ERROR, ide, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
region.getCachePerfStats().incDeltaFullValuesRequested();
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ce, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (ce instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (isDebugEnabled) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), ce);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
}
} else if (isDebugEnabled) {
- logger.debug("{}: Unexpected Exception", servConn.getName(), ce);
+ logger.debug("{}: Unexpected Exception", serverConnection.getName(), ce);
}
return;
} finally {
@@ -443,21 +443,21 @@ public class Put65 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, sendOldValue, oldValueIsObject, oldValue,
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, sendOldValue, oldValueIsObject, oldValue,
pr.getNetworkHopType(), clientEvent.getVersionTag());
pr.clearNetworkHopData();
} else {
- writeReply(msg, servConn, sendOldValue, oldValueIsObject, oldValue,
+ writeReply(clientMessage, serverConnection, sendOldValue, oldValueIsObject, oldValue,
clientEvent.getVersionTag());
}
} else {
- writeReply(msg, servConn, sendOldValue, oldValueIsObject, oldValue,
+ writeReply(clientMessage, serverConnection, sendOldValue, oldValueIsObject, oldValue,
clientEvent.getVersionTag());
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (isDebugEnabled) {
logger.debug("{}: Sent put response back to {} for region {} key {} value {}",
- servConn.getName(), servConn.getSocketString(), regionName, key, valuePart);
+ serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
}
stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
@@ -471,7 +471,7 @@ public class Put65 extends BaseCommand {
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(sendOldValue ? 3 : 1);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
+ replyMsg.addBytesPart(okBytes());
if (sendOldValue) {
replyMsg.addIntPart(oldValueIsObject ? 1 : 0);
replyMsg.addObjPart(oldValue);
@@ -499,7 +499,7 @@ public class Put65 extends BaseCommand {
replyMsg.send(servConn);
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {} parts={}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {} parts={}", servConn.getName(),
origMsg.getTransactionId(), replyMsg.getNumberOfParts());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
index 38eb7ef..395dbce 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
@@ -62,7 +62,7 @@ public class Put70 extends Put65 {
}
replyMsg.setNumberOfParts(parts);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
+ replyMsg.addBytesPart(okBytes());
replyMsg.addIntPart(flags);
if (sendOldValue) {
replyMsg.addObjPart(oldValue);
@@ -114,7 +114,7 @@ public class Put70 extends Put65 {
replyMsg.send(servConn);
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {} parts={}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {} parts={}", servConn.getName(),
origMsg.getTransactionId(), replyMsg.getNumberOfParts());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll.java
index 0bcfd1b..281f737 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll.java
@@ -59,7 +59,7 @@ public class PutAll extends BaseCommand {
private PutAll() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, numberOfKeysPart = null, keyPart = null, valuePart = null;
String regionName = null;
@@ -67,12 +67,12 @@ public class PutAll extends BaseCommand {
Object key = null;
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
boolean replyWithMetaData = false;
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
@@ -82,64 +82,64 @@ public class PutAll extends BaseCommand {
try {
// Retrieve the data from the message parts
// part 0: region name
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
if (regionName == null) {
String putAllMsg =
LocalizedStrings.PutAll_THE_INPUT_REGION_NAME_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
String reason = " was not found during put request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// part 1: eventID
- eventPart = msg.getPart(1);
+ eventPart = clientMessage.getPart(1);
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
// part 2: number of keys
- numberOfKeysPart = msg.getPart(2);
+ numberOfKeysPart = clientMessage.getPart(2);
numberOfKeys = numberOfKeysPart.getInt();
// building the map
Map map = new LinkedHashMap();
// Map isObjectMap = new LinkedHashMap();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(3 + i * 2);
+ keyPart = clientMessage.getPart(3 + i * 2);
key = keyPart.getStringOrObject();
if (key == null) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_KEYS_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- valuePart = msg.getPart(3 + i * 2 + 1);
+ valuePart = clientMessage.getPart(3 + i * 2 + 1);
if (valuePart.isNull()) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_VALUES_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -155,15 +155,15 @@ public class PutAll extends BaseCommand {
// isObjectMap.put(key, new Boolean(isObject));
} // for
- if (msg.getNumberOfParts() == (3 + 2 * numberOfKeys + 1)) {// it means optional timeout has
+ if (clientMessage.getNumberOfParts() == (3 + 2 * numberOfKeys + 1)) {// it means optional timeout has
// been added
- int timeout = msg.getPart(3 + 2 * numberOfKeys).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ int timeout = clientMessage.getPart(3 + 2 * numberOfKeys).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
this.securityService.authorizeRegionWrite(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
authzRequest.createRegionAuthorize(regionName);
@@ -179,41 +179,41 @@ public class PutAll extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug("{}: Received putAll request ({} bytes) from {} for region {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName);
}
region.basicBridgePutAll(map, Collections.<Object, VersionTag>emptyMap(),
- servConn.getProxyID(), eventId, false, null);
+ serverConnection.getProxyID(), eventId, false, null);
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
replyWithMetaData = true;
}
}
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, re, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (PutAllPartialResultException pre) {
- writeException(msg, pre, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, pre, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ce, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
logger.warn(LocalizedMessage.create(LocalizedStrings.Generic_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), ce);
+ serverConnection.getName()), ce);
return;
} finally {
long oldStart = start;
@@ -223,12 +223,12 @@ public class PutAll extends BaseCommand {
// Increment statistics and write the reply
if (!replyWithMetaData) {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent putAll response back to {} for region {}", servConn.getName(),
- servConn.getSocketString(), regionName);
+ logger.debug("{}: Sent putAll response back to {} for region {}", serverConnection.getName(),
+ serverConnection.getSocketString(), regionName);
}
stats.incWritePutAllResponseTime(DistributionStats.getStatTime() - start);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll70.java
index c5fcbae..ae2de09 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll70.java
@@ -62,7 +62,7 @@ public class PutAll70 extends BaseCommand {
private PutAll70() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long startp)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startp)
throws IOException, InterruptedException {
long start = startp; // copy this since we need to modify it
Part regionNamePart = null, numberOfKeysPart = null, keyPart = null, valuePart = null;
@@ -74,11 +74,11 @@ public class PutAll70 extends BaseCommand {
VersionedObjectList response = null;
StringBuffer errMessage = new StringBuffer();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
@@ -88,40 +88,40 @@ public class PutAll70 extends BaseCommand {
try {
// Retrieve the data from the message parts
// part 0: region name
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
if (regionName == null) {
String putAllMsg =
LocalizedStrings.PutAll_THE_INPUT_REGION_NAME_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
String reason = " was not found during put request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// part 1: eventID
- eventPart = msg.getPart(1);
+ eventPart = clientMessage.getPart(1);
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
// part 2: invoke callbacks (used by import)
- Part callbacksPart = msg.getPart(2);
+ Part callbacksPart = clientMessage.getPart(2);
boolean skipCallbacks = callbacksPart.getInt() == 1 ? true : false;
// part 3: number of keys
- numberOfKeysPart = msg.getPart(3);
+ numberOfKeysPart = clientMessage.getPart(3);
numberOfKeys = numberOfKeysPart.getInt();
// building the map
@@ -129,28 +129,28 @@ public class PutAll70 extends BaseCommand {
Map<Object, VersionTag> retryVersions = new LinkedHashMap<Object, VersionTag>();
// Map isObjectMap = new LinkedHashMap();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(4 + i * 2);
+ keyPart = clientMessage.getPart(4 + i * 2);
key = keyPart.getStringOrObject();
if (key == null) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_KEYS_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- valuePart = msg.getPart(4 + i * 2 + 1);
+ valuePart = clientMessage.getPart(4 + i * 2 + 1);
if (valuePart.isNull()) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_VALUES_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -170,7 +170,7 @@ public class PutAll70 extends BaseCommand {
value = valuePart.getSerializedForm();
}
// put serializedform for auth. It will be modified with auth callback
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// Constuct the thread id/sequence id information for this element in the
// put all map
@@ -198,15 +198,15 @@ public class PutAll70 extends BaseCommand {
// isObjectMap.put(key, new Boolean(isObject));
} // for
- if (msg.getNumberOfParts() == (4 + 2 * numberOfKeys + 1)) {// it means optional timeout has
+ if (clientMessage.getNumberOfParts() == (4 + 2 * numberOfKeys + 1)) {// it means optional timeout has
// been added
- int timeout = msg.getPart(4 + 2 * numberOfKeys).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ int timeout = clientMessage.getPart(4 + 2 * numberOfKeys).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
this.securityService.authorizeRegionWrite(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
authzRequest.createRegionAuthorize(regionName);
@@ -231,10 +231,10 @@ public class PutAll70 extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug("{}: Received putAll request ({} bytes) from {} for region {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName);
}
- response = region.basicBridgePutAll(map, retryVersions, servConn.getProxyID(), eventId,
+ response = region.basicBridgePutAll(map, retryVersions, serverConnection.getProxyID(), eventId,
skipCallbacks, null);
if (!region.getConcurrencyChecksEnabled()) {
// the client only needs this if versioning is being used
@@ -244,33 +244,33 @@ public class PutAll70 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, response, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, response, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
replyWithMetaData = true;
}
}
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, re, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (PutAllPartialResultException pre) {
- writeException(msg, pre, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, pre, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ce, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
// if (logger.fineEnabled()) {
logger.warn(LocalizedMessage.create(LocalizedStrings.Generic_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), ce);
+ serverConnection.getName()), ce);
// }
return;
} finally {
@@ -279,11 +279,11 @@ public class PutAll70 extends BaseCommand {
stats.incProcessPutAllTime(start - oldStart);
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending putAll70 response back to {} for region {}: {}", servConn.getName(),
- servConn.getSocketString(), regionName, response);
+ logger.debug("{}: Sending putAll70 response back to {} for region {}: {}", serverConnection.getName(),
+ serverConnection.getSocketString(), regionName, response);
}
// Starting in 7.0.1 we do not send the keys back
- if (response != null && Version.GFE_70.compareTo(servConn.getClientVersion()) < 0) {
+ if (response != null && Version.GFE_70.compareTo(serverConnection.getClientVersion()) < 0) {
if (logger.isDebugEnabled()) {
logger.debug("setting putAll keys to null");
}
@@ -292,14 +292,14 @@ public class PutAll70 extends BaseCommand {
// Increment statistics and write the reply
if (!replyWithMetaData) {
- writeReply(msg, response, servConn);
+ writeReply(clientMessage, response, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
stats.incWritePutAllResponseTime(DistributionStats.getStatTime() - start);
}
@Override
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
throw new UnsupportedOperationException();
}
@@ -311,7 +311,7 @@ public class PutAll70 extends BaseCommand {
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(2);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
+ replyMsg.addBytesPart(okBytes());
if (response != null) {
response.clearObjects();
replyMsg.addObjPart(response);
@@ -323,7 +323,7 @@ public class PutAll70 extends BaseCommand {
}
@Override
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
throw new UnsupportedOperationException();
}
@@ -343,7 +343,7 @@ public class PutAll70 extends BaseCommand {
replyMsg.send(servConn);
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll80.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll80.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll80.java
index a6285ed..aed5926 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll80.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutAll80.java
@@ -75,7 +75,7 @@ public class PutAll80 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long startp)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startp)
throws IOException, InterruptedException {
long start = startp; // copy this since we need to modify it
Part regionNamePart = null, numberOfKeysPart = null, keyPart = null, valuePart = null;
@@ -87,12 +87,12 @@ public class PutAll80 extends BaseCommand {
VersionedObjectList response = null;
StringBuffer errMessage = new StringBuffer();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE); // new in 8.0
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE); // new in 8.0
{
long oldStart = start;
start = DistributionStats.getStatTime();
@@ -102,60 +102,60 @@ public class PutAll80 extends BaseCommand {
try {
// Retrieve the data from the message parts
// part 0: region name
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
if (regionName == null) {
String putAllMsg =
LocalizedStrings.PutAll_THE_INPUT_REGION_NAME_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeChunkedErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
LocalRegion region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
String reason = " was not found during putAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
final int BASE_PART_COUNT = getBasePartCount();
// part 1: eventID
- eventPart = msg.getPart(1);
+ eventPart = clientMessage.getPart(1);
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
Breadcrumbs.setEventId(eventId);
// part 2: invoke callbacks (used by import)
- Part callbacksPart = msg.getPart(2);
+ Part callbacksPart = clientMessage.getPart(2);
boolean skipCallbacks = callbacksPart.getInt() == 1 ? true : false;
// part 3: flags
- int flags = msg.getPart(3).getInt();
+ int flags = clientMessage.getPart(3).getInt();
boolean clientIsEmpty = (flags & PutAllOp.FLAG_EMPTY) != 0;
boolean clientHasCCEnabled = (flags & PutAllOp.FLAG_CONCURRENCY_CHECKS) != 0;
// part 4: number of keys
- numberOfKeysPart = msg.getPart(4);
+ numberOfKeysPart = clientMessage.getPart(4);
numberOfKeys = numberOfKeysPart.getInt();
- Object callbackArg = getOptionalCallbackArg(msg);
+ Object callbackArg = getOptionalCallbackArg(clientMessage);
if (logger.isDebugEnabled()) {
StringBuilder buffer = new StringBuilder();
- buffer.append(servConn.getName()).append(": Received ").append(this.putAllClassName())
- .append(" request from ").append(servConn.getSocketString()).append(" for region ")
- .append(regionName).append(callbackArg != null ? (" callbackArg " + callbackArg) : "")
- .append(" with ").append(numberOfKeys).append(" entries.");
+ buffer.append(serverConnection.getName()).append(": Received ").append(this.putAllClassName())
+ .append(" request from ").append(serverConnection.getSocketString()).append(" for region ")
+ .append(regionName).append(callbackArg != null ? (" callbackArg " + callbackArg) : "")
+ .append(" with ").append(numberOfKeys).append(" entries.");
logger.debug(buffer.toString());
}
// building the map
@@ -163,30 +163,28 @@ public class PutAll80 extends BaseCommand {
Map<Object, VersionTag> retryVersions = new LinkedHashMap<Object, VersionTag>();
// Map isObjectMap = new LinkedHashMap();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(BASE_PART_COUNT + i * 2);
+ keyPart = clientMessage.getPart(BASE_PART_COUNT + i * 2);
key = keyPart.getStringOrObject();
if (key == null) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_KEYS_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeChunkedErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- valuePart = msg.getPart(BASE_PART_COUNT + i * 2 + 1);
+ valuePart = clientMessage.getPart(BASE_PART_COUNT + i * 2 + 1);
if (valuePart.isNull()) {
String putAllMsg =
LocalizedStrings.PutAll_ONE_OF_THE_INPUT_VALUES_FOR_THE_PUTALL_REQUEST_IS_NULL
.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), putAllMsg);
+ logger.warn("{}: {}", serverConnection.getName(), putAllMsg);
errMessage.append(putAllMsg);
- writeChunkedErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -206,7 +204,7 @@ public class PutAll80 extends BaseCommand {
value = valuePart.getSerializedForm();
}
// put serializedform for auth. It will be modified with auth callback
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// Constuct the thread id/sequence id information for this element in the
// put all map
@@ -234,16 +232,16 @@ public class PutAll80 extends BaseCommand {
// isObjectMap.put(key, new Boolean(isObject));
} // for
- if (msg.getNumberOfParts() == (BASE_PART_COUNT + 2 * numberOfKeys + 1)) {// it means optional
+ if (clientMessage.getNumberOfParts() == (BASE_PART_COUNT + 2 * numberOfKeys + 1)) {// it means optional
// timeout has been
// added
- int timeout = msg.getPart(BASE_PART_COUNT + 2 * numberOfKeys).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ int timeout = clientMessage.getPart(BASE_PART_COUNT + 2 * numberOfKeys).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
this.securityService.authorizeRegionWrite(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
authzRequest.createRegionAuthorize(regionName);
@@ -267,7 +265,7 @@ public class PutAll80 extends BaseCommand {
*/
}
- response = region.basicBridgePutAll(map, retryVersions, servConn.getProxyID(), eventId,
+ response = region.basicBridgePutAll(map, retryVersions, serverConnection.getProxyID(), eventId,
skipCallbacks, callbackArg);
if (!region.getConcurrencyChecksEnabled() || clientIsEmpty || !clientHasCCEnabled) {
// the client only needs this if versioning is being used and the client
@@ -283,32 +281,32 @@ public class PutAll80 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, response, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, response, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
replyWithMetaData = true;
}
}
} catch (RegionDestroyedException rde) {
- writeChunkedException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, rde, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeChunkedException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, re, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (PutAllPartialResultException pre) {
- writeChunkedException(msg, pre, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, pre, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeChunkedException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ce, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
logger.warn(LocalizedMessage.create(LocalizedStrings.Generic_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), ce);
+ serverConnection.getName()), ce);
return;
} finally {
long oldStart = start;
@@ -316,21 +314,21 @@ public class PutAll80 extends BaseCommand {
stats.incProcessPutAllTime(start - oldStart);
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending {} response back to {} for regin {} {}", servConn.getName(),
- putAllClassName(), servConn.getSocketString(), regionName,
+ logger.debug("{}: Sending {} response back to {} for regin {} {}", serverConnection.getName(),
+ putAllClassName(), serverConnection.getSocketString(), regionName,
(logger.isTraceEnabled() ? ": " + response : ""));
}
// Increment statistics and write the reply
if (!replyWithMetaData) {
- writeReply(msg, response, servConn);
+ writeReply(clientMessage, response, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
stats.incWritePutAllResponseTime(DistributionStats.getStatTime() - start);
}
@Override
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
throw new UnsupportedOperationException();
}
@@ -351,7 +349,7 @@ public class PutAll80 extends BaseCommand {
}
replyMsg.sendHeader();
if (listSize > 0) {
- int chunkSize = 2 * maximumChunkSize;
+ int chunkSize = 2 * MAXIMUM_CHUNK_SIZE;
// Chunker will stream over the list in its toData method
VersionedObjectList.Chunker chunk =
new VersionedObjectList.Chunker(response, chunkSize, false, false);
@@ -383,7 +381,7 @@ public class PutAll80 extends BaseCommand {
}
@Override
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
throw new UnsupportedOperationException();
}
@@ -411,7 +409,7 @@ public class PutAll80 extends BaseCommand {
replyMsg.setLastChunk(false);
replyMsg.sendChunk(servConn);
- int chunkSize = 2 * maximumChunkSize; // maximumChunkSize
+ int chunkSize = 2 * MAXIMUM_CHUNK_SIZE; // MAXIMUM_CHUNK_SIZE
// Chunker will stream over the list in its toData method
VersionedObjectList.Chunker chunk =
new VersionedObjectList.Chunker(response, chunkSize, false, false);
@@ -437,7 +435,7 @@ public class PutAll80 extends BaseCommand {
}
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutUserCredentials.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutUserCredentials.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutUserCredentials.java
index 198eed6..dc3de67 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutUserCredentials.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PutUserCredentials.java
@@ -32,39 +32,39 @@ public class PutUserCredentials extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
- boolean isSecureMode = msg.isSecureMode();
+ boolean isSecureMode = clientMessage.isSecureMode();
// if (!isSecureMode)
// client has not send secuirty header, need to send exception and log this in security (file)
if (isSecureMode) {
- int numberOfParts = msg.getNumberOfParts();
+ int numberOfParts = clientMessage.getNumberOfParts();
if (numberOfParts == 1) {
// need to get credentials
try {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- byte[] uniqueId = servConn.setCredentials(msg);
- writeResponse(uniqueId, null, msg, false, servConn);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ byte[] uniqueId = serverConnection.setCredentials(clientMessage);
+ writeResponse(uniqueId, null, clientMessage, false, serverConnection);
} catch (GemFireSecurityException gfse) {
- if (servConn.getSecurityLogWriter().warningEnabled()) {
- servConn.getSecurityLogWriter().warning(LocalizedStrings.ONE_ARG, servConn.getName()
- + ": Security exception: " + gfse.toString()
- + (gfse.getCause() != null ? ", caused by: " + gfse.getCause().toString() : ""));
+ if (serverConnection.getSecurityLogWriter().warningEnabled()) {
+ serverConnection.getSecurityLogWriter().warning(LocalizedStrings.ONE_ARG, serverConnection.getName()
+ + ": Security exception: " + gfse.toString()
+ + (gfse.getCause() != null ? ", caused by: " + gfse.getCause().toString() : ""));
}
- writeException(msg, gfse, false, servConn);
+ writeException(clientMessage, gfse, false, serverConnection);
} catch (Exception ex) {
- if (servConn.getLogWriter().warningEnabled()) {
- servConn.getLogWriter().warning(
+ if (serverConnection.getLogWriter().warningEnabled()) {
+ serverConnection.getLogWriter().warning(
LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1,
- new Object[] {servConn.getProxyID(), ""}, ex);
+ new Object[] { serverConnection.getProxyID(), ""}, ex);
}
- writeException(msg, ex, false, servConn);
+ writeException(clientMessage, ex, false, serverConnection);
} finally {
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
index d3c0393..8b5b35e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query.java
@@ -43,38 +43,38 @@ public class Query extends BaseCommandQuery {
protected Query() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
// Based on MessageType.DESTROY
// Added by gregp 10/18/05
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the data from the message parts
- String queryString = msg.getPart(0).getString();
+ String queryString = clientMessage.getPart(0).getString();
// this is optional part for message specific timeout, which right now send by native client
// need to take care while adding new message
- if (msg.getNumberOfParts() == 3) {
- int timeout = msg.getPart(2).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ if (clientMessage.getNumberOfParts() == 3) {
+ int timeout = clientMessage.getPart(2).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received query request from {} queryString: {}", servConn.getName(),
- servConn.getSocketString(), queryString);
+ logger.debug("{}: Received query request from {} queryString: {}", serverConnection.getName(),
+ serverConnection.getSocketString(), queryString);
}
try {
// Create query
QueryService queryService =
- servConn.getCachedRegionHelper().getCache().getLocalQueryService();
+ serverConnection.getCachedRegionHelper().getCache().getLocalQueryService();
org.apache.geode.cache.query.Query query = queryService.newQuery(queryString);
Set regionNames = ((DefaultQuery) query).getRegionsInQuery(null);
// Authorization check
QueryOperationContext queryContext = null;
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
queryContext = authzRequest.queryAuthorize(queryString, regionNames);
String newQueryString = queryContext.getQuery();
@@ -88,11 +88,11 @@ public class Query extends BaseCommandQuery {
}
}
- processQuery(msg, query, queryString, regionNames, start, null, queryContext, servConn, true);
+ processQuery(clientMessage, query, queryString, regionNames, start, null, queryContext, serverConnection, true);
} catch (QueryInvalidException e) {
throw new QueryInvalidException(e.getMessage() + queryString);
} catch (QueryExecutionLowMemoryException e) {
- writeQueryResponseException(msg, e, false, servConn);
+ writeQueryResponseException(clientMessage, e, serverConnection);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
index 5849431..97f5d56 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Query651.java
@@ -44,40 +44,40 @@ public class Query651 extends BaseCommandQuery {
protected Query651() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
// Based on MessageType.DESTROY
// Added by gregp 10/18/05
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the data from the message parts
- String queryString = msg.getPart(0).getString();
+ String queryString = clientMessage.getPart(0).getString();
long compiledQueryId = 0;
Object[] queryParams = null;
try {
- if (msg.getMessageType() == MessageType.QUERY_WITH_PARAMETERS) {
+ if (clientMessage.getMessageType() == MessageType.QUERY_WITH_PARAMETERS) {
// Query with parameters supported from 6.6 onwards.
- int params = msg.getPart(1).getInt(); // Number of parameters.
+ int params = clientMessage.getPart(1).getInt(); // Number of parameters.
// In case of native client there will be extra two parameters at 2 and 3 index.
int paramStartIndex = 2;
- if (msg.getNumberOfParts() > (1 /* type */ + 1 /* query string */ + 1 /* params length */
- + params /* number of params */)) {
- int timeout = msg.getPart(3).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ if (clientMessage.getNumberOfParts() > (1 /* type */ + 1 /* query string */ + 1 /* params length */
+ + params /* number of params */)) {
+ int timeout = clientMessage.getPart(3).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
paramStartIndex = 4;
}
// Get the query execution parameters.
queryParams = new Object[params];
for (int i = 0; i < queryParams.length; i++) {
- queryParams[i] = msg.getPart(i + paramStartIndex).getObject();
+ queryParams[i] = clientMessage.getPart(i + paramStartIndex).getObject();
}
} else {
// this is optional part for message specific timeout, which right now send by native client
// need to take care while adding new message
- if (msg.getNumberOfParts() == 3) {
- int timeout = msg.getPart(2).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ if (clientMessage.getNumberOfParts() == 3) {
+ int timeout = clientMessage.getPart(2).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
}
} catch (ClassNotFoundException cne) {
@@ -85,19 +85,19 @@ public class Query651 extends BaseCommandQuery {
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received query request from {} queryString: {}{}", servConn.getName(),
- servConn.getSocketString(), queryString,
+ logger.debug("{}: Received query request from {} queryString: {}{}", serverConnection.getName(),
+ serverConnection.getSocketString(), queryString,
(queryParams != null ? (" with num query parameters :" + queryParams.length) : ""));
}
try {
// Create query
QueryService queryService =
- servConn.getCachedRegionHelper().getCache().getLocalQueryService();
+ serverConnection.getCachedRegionHelper().getCache().getLocalQueryService();
org.apache.geode.cache.query.Query query = null;
if (queryParams != null) {
// Its a compiled query.
- CacheClientNotifier ccn = servConn.getAcceptor().getCacheClientNotifier();
+ CacheClientNotifier ccn = serverConnection.getAcceptor().getCacheClientNotifier();
query = ccn.getCompiledQuery(queryString);
if (query == null) {
// This is first time the query is seen by this server.
@@ -114,7 +114,7 @@ public class Query651 extends BaseCommandQuery {
// Authorization check
QueryOperationContext queryContext = null;
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
queryContext = authzRequest.queryAuthorize(queryString, regionNames, queryParams);
String newQueryString = queryContext.getQuery();
@@ -128,8 +128,7 @@ public class Query651 extends BaseCommandQuery {
}
}
- processQueryUsingParams(msg, query, queryString, regionNames, start, null, queryContext,
- servConn, true, queryParams);
+ processQueryUsingParams(clientMessage, query, queryString, regionNames, start, null, queryContext, serverConnection, true, queryParams);
} catch (QueryInvalidException e) {
throw new QueryInvalidException(e.getMessage() + queryString);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterDataSerializers.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterDataSerializers.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterDataSerializers.java
index 7d28d52..d1c101f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterDataSerializers.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterDataSerializers.java
@@ -37,22 +37,22 @@ public class RegisterDataSerializers extends BaseCommand {
private RegisterDataSerializers() {}
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
if (logger.isDebugEnabled()) {
logger.debug("{}: Received register dataserializer request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int noOfParts = msg.getNumberOfParts();
+ int noOfParts = clientMessage.getNumberOfParts();
// 2 parts per instantiator and one eventId part
int noOfDataSerializers = (noOfParts - 1) / 2;
// retrieve eventID from the last Part
- ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(msg.getPart(noOfParts - 1).getSerializedForm());
+ ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(clientMessage.getPart(noOfParts - 1).getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
byte[][] serializedDataSerializers = new byte[noOfDataSerializers * 2][];
boolean caughtCNFE = false;
@@ -60,12 +60,12 @@ public class RegisterDataSerializers extends BaseCommand {
try {
for (int i = 0; i < noOfParts - 1; i = i + 2) {
- Part dataSerializerClassNamePart = msg.getPart(i);
+ Part dataSerializerClassNamePart = clientMessage.getPart(i);
serializedDataSerializers[i] = dataSerializerClassNamePart.getSerializedForm();
String dataSerializerClassName =
(String) CacheServerHelper.deserialize(serializedDataSerializers[i]);
- Part idPart = msg.getPart(i + 1);
+ Part idPart = clientMessage.getPart(i + 1);
serializedDataSerializers[i + 1] = idPart.getSerializedForm();
int id = idPart.getInt();
@@ -73,7 +73,7 @@ public class RegisterDataSerializers extends BaseCommand {
try {
dataSerializerClass = InternalDataSerializer.getCachedClass(dataSerializerClassName);
InternalDataSerializer.register(dataSerializerClass, true, eventId,
- servConn.getProxyID());
+ serverConnection.getProxyID());
} catch (ClassNotFoundException e) {
// If a ClassNotFoundException is caught, store it, but continue
// processing other instantiators
@@ -82,26 +82,26 @@ public class RegisterDataSerializers extends BaseCommand {
}
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
// If a ClassNotFoundException was caught while processing the
// instantiators, send it back to the client. Note: This only sends
// the last CNFE.
if (caughtCNFE) {
- writeException(msg, cnfe, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, cnfe, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
// Send reply to client if necessary. If an exception occurs in the above
// code, then the reply has already been sent.
- if (!servConn.getTransientFlag(RESPONDED)) {
- writeReply(msg, servConn);
+ if (!serverConnection.getTransientFlag(RESPONDED)) {
+ writeReply(clientMessage, serverConnection);
}
if (logger.isDebugEnabled()) {
- logger.debug("Registered dataserializer for MembershipId = {}", servConn.getMembershipID());
+ logger.debug("Registered dataserializer for MembershipId = {}", serverConnection.getMembershipID());
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInstantiators.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInstantiators.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInstantiators.java
index 1e701fc..2b63337 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInstantiators.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInstantiators.java
@@ -49,23 +49,23 @@ public class RegisterInstantiators extends BaseCommand {
private RegisterInstantiators() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
if (logger.isDebugEnabled()) {
logger.debug("{}: Received register instantiator request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int noOfParts = msg.getNumberOfParts();
+ int noOfParts = clientMessage.getNumberOfParts();
// Assert parts
Assert.assertTrue((noOfParts - 1) % 3 == 0);
// 3 parts per instantiator and one eventId part
int noOfInstantiators = (noOfParts - 1) / 3;
// retrieve eventID from the last Part
- ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(msg.getPart(noOfParts - 1).getSerializedForm());
+ ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(clientMessage.getPart(noOfParts - 1).getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
byte[][] serializedInstantiators = new byte[noOfInstantiators * 3][];
boolean caughtCNFE = false;
@@ -73,17 +73,17 @@ public class RegisterInstantiators extends BaseCommand {
try {
for (int i = 0; i < noOfParts - 1; i = i + 3) {
- Part instantiatorPart = msg.getPart(i);
+ Part instantiatorPart = clientMessage.getPart(i);
serializedInstantiators[i] = instantiatorPart.getSerializedForm();
String instantiatorClassName =
(String) CacheServerHelper.deserialize(serializedInstantiators[i]);
- Part instantiatedPart = msg.getPart(i + 1);
+ Part instantiatedPart = clientMessage.getPart(i + 1);
serializedInstantiators[i + 1] = instantiatedPart.getSerializedForm();
String instantiatedClassName =
(String) CacheServerHelper.deserialize(serializedInstantiators[i + 1]);
- Part idPart = msg.getPart(i + 2);
+ Part idPart = clientMessage.getPart(i + 2);
serializedInstantiators[i + 2] = idPart.getSerializedForm();
int id = idPart.getInt();
@@ -92,7 +92,7 @@ public class RegisterInstantiators extends BaseCommand {
instantiatorClass = InternalDataSerializer.getCachedClass(instantiatorClassName);
instantiatedClass = InternalDataSerializer.getCachedClass(instantiatedClassName);
InternalInstantiator.register(instantiatorClass, instantiatedClass, id, true, eventId,
- servConn.getProxyID());
+ serverConnection.getProxyID());
} catch (ClassNotFoundException e) {
// If a ClassNotFoundException is caught, store it, but continue
// processing other instantiators
@@ -102,17 +102,17 @@ public class RegisterInstantiators extends BaseCommand {
}
} catch (Exception e) {
logger.warn(LocalizedMessage.create(LocalizedStrings.RegisterInstantiators_BAD_CLIENT,
- new Object[] {servConn.getMembershipID(), e.getLocalizedMessage()}));
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ new Object[] { serverConnection.getMembershipID(), e.getLocalizedMessage()}));
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
// If a ClassNotFoundException was caught while processing the
// instantiators, send it back to the client. Note: This only sends
// the last CNFE.
if (caughtCNFE) {
- writeException(msg, cnfe, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, cnfe, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
// Send the instantiators on to other clients if we hit an error
// due to a missing class, because they were not distributed
@@ -120,7 +120,7 @@ public class RegisterInstantiators extends BaseCommand {
// been distributed if successfully registered.
ClientInstantiatorMessage clientInstantiatorMessage =
new ClientInstantiatorMessage(EnumListenerEvent.AFTER_REGISTER_INSTANTIATOR,
- serializedInstantiators, servConn.getProxyID(), eventId);
+ serializedInstantiators, serverConnection.getProxyID(), eventId);
// Notify other clients
CacheClientNotifier.routeClientMessage(clientInstantiatorMessage);
@@ -129,12 +129,12 @@ public class RegisterInstantiators extends BaseCommand {
// Send reply to client if necessary. If an exception occurs in the above
// code, then the reply has already been sent.
- if (!servConn.getTransientFlag(RESPONDED)) {
- writeReply(msg, servConn);
+ if (!serverConnection.getTransientFlag(RESPONDED)) {
+ writeReply(clientMessage, serverConnection);
}
if (logger.isDebugEnabled()) {
- logger.debug("Registered instantiators for MembershipId = {}", servConn.getMembershipID());
+ logger.debug("Registered instantiators for MembershipId = {}", serverConnection.getMembershipID());
}
}
[11/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
new file mode 100644
index 0000000..1f99dac
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/NonLocalRegionEntryTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class NonLocalRegionEntryTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ NonLocalRegionEntry mockNonLocalRegionEntry = mock(NonLocalRegionEntry.class);
+ RegionEntryContext mockRegionEntryContext = mock(RegionEntryContext.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ Object valueInVM = new Object();
+ Object valueOnDisk = new Object();
+
+ when(mockNonLocalRegionEntry.getValueInVM(eq(mockRegionEntryContext))).thenReturn(valueInVM);
+ when(mockNonLocalRegionEntry.getValueInVMOrDiskWithoutFaultIn(eq(mockLocalRegion)))
+ .thenReturn(valueOnDisk);
+
+ assertThat(mockNonLocalRegionEntry.getValueInVM(mockRegionEntryContext)).isSameAs(valueInVM);
+ assertThat(mockNonLocalRegionEntry.getValueInVMOrDiskWithoutFaultIn(mockLocalRegion))
+ .isSameAs(valueOnDisk);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
index ed23f2a..1e56d00 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
@@ -487,7 +487,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest
* <p>
* Added specifically to test scenario of defect #47181.
*/
- private final Cache createLonerCacheWithEnforceUniqueHost() {
+ private Cache createLonerCacheWithEnforceUniqueHost() {
Cache myCache = null;
try {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE",
@@ -519,7 +519,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest
* <p>
* Added specifically to test scenario of defect #47181.
*/
- private final InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
+ private InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
Properties props = getDistributedSystemProperties();
props.put(MCAST_PORT, "0");
props.put(LOCATORS, "");
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
new file mode 100644
index 0000000..a638b14
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PlaceHolderDiskRegionTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class PlaceHolderDiskRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ PlaceHolderDiskRegion mockPlaceHolderDiskRegion = mock(PlaceHolderDiskRegion.class);
+ when(mockPlaceHolderDiskRegion.getName()).thenReturn("NAME");
+ assertThat(mockPlaceHolderDiskRegion.getName()).isEqualTo("NAME");
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
new file mode 100644
index 0000000..115a1d9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ProxyBucketRegionTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ProxyBucketRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ProxyBucketRegion mockProxyBucketRegion = mock(ProxyBucketRegion.class);
+ BucketAdvisor mockBucketAdvisor = mock(BucketAdvisor.class);
+
+ when(mockProxyBucketRegion.getBucketAdvisor()).thenReturn(mockBucketAdvisor);
+
+ assertThat(mockProxyBucketRegion.getBucketAdvisor()).isSameAs(mockBucketAdvisor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
new file mode 100644
index 0000000..f02da45
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteFetchEntryMessageTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoteFetchEntryMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoteFetchEntryMessage mockRemoteFetchEntryMessage = mock(RemoteFetchEntryMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ long startTime = System.currentTimeMillis();
+
+ when(mockRemoteFetchEntryMessage.operateOnRegion(eq(mockDistributionManager),
+ eq(mockLocalRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockRemoteFetchEntryMessage.operateOnRegion(mockDistributionManager, mockLocalRegion,
+ startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
new file mode 100644
index 0000000..29c5a78
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemotePutAllMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.DataInput;
+
+@Category(UnitTest.class)
+public class RemotePutAllMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemotePutAllMessage mockRemotePutAllMessage = mock(RemotePutAllMessage.class);
+ DataInput mockDataInput = mock(DataInput.class);
+
+ mockRemotePutAllMessage.fromData(mockDataInput);
+
+ verify(mockRemotePutAllMessage, times(1)).fromData(mockDataInput);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
new file mode 100644
index 0000000..1205c9a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RemoteRemoveAllMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.DataInput;
+
+@Category(UnitTest.class)
+public class RemoteRemoveAllMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoteRemoveAllMessage mockRemoteRemoveAllMessage = mock(RemoteRemoveAllMessage.class);
+ DataInput mockDataInput = mock(DataInput.class);
+
+ mockRemoteRemoveAllMessage.fromData(mockDataInput);
+
+ verify(mockRemoteRemoveAllMessage, times(1)).fromData(mockDataInput);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
new file mode 100644
index 0000000..96c312f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestFilterInfoMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestFilterInfoMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestFilterInfoMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestFilterInfoMessage mockRequestFilterInfoMessage = mock(RequestFilterInfoMessage.class);
+ when(mockRequestFilterInfoMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestFilterInfoMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
new file mode 100644
index 0000000..11f633a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestImageMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestImageMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestImageMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestImageMessage mockRequestImageMessage = mock(RequestImageMessage.class);
+ when(mockRequestImageMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestImageMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
new file mode 100644
index 0000000..8355e5c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RequestRVVMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.InitialImageOperation.RequestRVVMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RequestRVVMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RequestRVVMessage mockRequestRVVMessage = mock(RequestRVVMessage.class);
+ when(mockRequestRVVMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockRequestRVVMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
new file mode 100644
index 0000000..761064f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/StateMarkerMessageTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.StateFlushOperation.StateMarkerMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class StateMarkerMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ StateMarkerMessage mockStateMarkerMessage = mock(StateMarkerMessage.class);
+ when(mockStateMarkerMessage.getProcessorType()).thenReturn(1);
+ assertThat(mockStateMarkerMessage.getProcessorType()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
new file mode 100644
index 0000000..052d174
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXEventTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXEventTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXEvent mockTXEvent = mock(TXEvent.class);
+ Cache mockCache = mock(Cache.class);
+ when(mockTXEvent.getCache()).thenReturn(mockCache);
+ assertThat(mockTXEvent.getCache()).isSameAs(mockCache);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
new file mode 100644
index 0000000..76c1e79
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXMessageTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXMessage mockTXMessage = mock(TXMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockTXMessage.getMemberToMasqueradeAs()).thenReturn(mockInternalDistributedMember);
+ assertThat(mockTXMessage.getMemberToMasqueradeAs()).isSameAs(mockInternalDistributedMember);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
new file mode 100644
index 0000000..6c5a349
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateStubTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tx.TXRegionStub;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class TXStateStubTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ TXStateStub mockTXStateStub = mock(TXStateStub.class);
+ TXRegionStub mockTXRegionStub = mock(TXRegionStub.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+ when(mockTXStateStub.getTXRegionStub(eq(mockLocalRegion))).thenReturn(mockTXRegionStub);
+ assertThat(mockTXStateStub.getTXRegionStub(mockLocalRegion)).isSameAs(mockTXRegionStub);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java b/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
index f6558c0..77f3867 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/UnzipUtil.java
@@ -32,7 +32,7 @@ import java.util.zip.ZipInputStream;
*/
public class UnzipUtil {
- public static final void unzip(InputStream input, String targetDir) throws IOException {
+ public static void unzip(InputStream input, String targetDir) throws IOException {
File dir = new File(targetDir);
if (!dir.exists() && !dir.mkdir()) {
@@ -62,7 +62,7 @@ public class UnzipUtil {
zipInput.close();
}
- public static final void copyInputStream(InputStream in, OutputStream out) throws IOException {
+ public static void copyInputStream(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int len;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
new file mode 100644
index 0000000..324c121
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/control/ResourceAdvisorTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.control;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ResourceAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ResourceAdvisor mockResourceAdvisor = mock(ResourceAdvisor.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockResourceAdvisor.isHeapCritical(eq((mockInternalDistributedMember)))).thenReturn(true);
+ assertThat(mockResourceAdvisor.isHeapCritical(mockInternalDistributedMember)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
index 438d938..915cddf 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/ConflatableObject.java
@@ -121,70 +121,70 @@ public class ConflatableObject implements Conflatable, Serializable {
/**
* @return Returns the conflate.
*/
- final boolean isConflate() {
+ boolean isConflate() {
return conflate;
}
/**
* @param conflate The conflate to set.
*/
- final void setConflate(boolean conflate) {
+ void setConflate(boolean conflate) {
this.conflate = conflate;
}
/**
* @return Returns the id.
*/
- final EventID getId() {
+ EventID getId() {
return id;
}
/**
* @param id The id to set.
*/
- final void setId(EventID id) {
+ void setId(EventID id) {
this.id = id;
}
/**
* @return Returns the key.
*/
- final Object getKey() {
+ Object getKey() {
return key;
}
/**
* @param key The key to set.
*/
- final void setKey(Object key) {
+ void setKey(Object key) {
this.key = key;
}
/**
* @return Returns the regionname.
*/
- final String getRegionname() {
+ String getRegionname() {
return regionname;
}
/**
* @param regionname The regionname to set.
*/
- final void setRegionname(String regionname) {
+ void setRegionname(String regionname) {
this.regionname = regionname;
}
/**
* @return Returns the value.
*/
- final Object getValue() {
+ Object getValue() {
return value;
}
/**
* @param value The value to set.
*/
- final void setValue(Object value) {
+ void setValue(Object value) {
this.value = value;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
new file mode 100644
index 0000000..3341083
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/lru/LRUAlgorithmTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.lru;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class LRUAlgorithmTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ LRUAlgorithm mockLRUAlgorithm = mock(LRUAlgorithm.class);
+ EnableLRU mockEnableLRU = mock(EnableLRU.class);
+ when(mockLRUAlgorithm.getLRUHelper()).thenReturn(mockEnableLRU);
+ assertThat(mockLRUAlgorithm.getLRUHelper()).isEqualTo(mockEnableLRU);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
new file mode 100644
index 0000000..9dd1cd8
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessageTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class BucketBackupMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ BucketBackupMessage mockBucketBackupMessage = mock(BucketBackupMessage.class);
+ when(mockBucketBackupMessage.failIfRegionMissing()).thenReturn(true);
+ assertThat(mockBucketBackupMessage.failIfRegionMissing()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
index b95e11a..c5fea71 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java
@@ -15,43 +15,26 @@
package org.apache.geode.internal.cache.partitioned;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class ColocatedRegionDetailsJUnitTest {
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {}
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {}
-
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#ColocatedRegionDetails(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
- */
@Test
- public final void testColocatedRegionDetailsConstructor() {
+ public void testColocatedRegionDetailsConstructor() {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host", "member name", "parent region", "child region");
assertNotNull(crd);
@@ -61,12 +44,8 @@ public class ColocatedRegionDetailsJUnitTest {
assertEquals("child region", crd.getChild());
}
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#ColocatedRegionDetails()}.
- */
@Test
- public final void testColocatedRegion0ArgConstructor() {
+ public void testColocatedRegion0ArgConstructor() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
assertNotNull(crd);
assertNull(crd.getHost());
@@ -77,7 +56,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testContructingWithNulls() {
+ public void testConstructingWithNulls() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails(null, "member name", "parent region", "child region");
ColocatedRegionDetails crd2 =
@@ -93,15 +72,8 @@ public class ColocatedRegionDetailsJUnitTest {
assertNotNull(crd4);
}
- /**
- * Test method for
- * {@link org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails#toData(java.io.DataOutput)}.
- *
- * @throws IOException
- * @throws ClassNotFoundException
- */
@Test
- public final void testSerialization() throws IOException, ClassNotFoundException {
+ public void testSerialization() throws Exception {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host", "member name", "parent region", "child region");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -114,8 +86,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testSerializationOfEmptyColocatedRegionDetails()
- throws IOException, ClassNotFoundException {
+ public void testSerializationOfEmptyColocatedRegionDetails() throws Exception {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput out = new DataOutputStream(baos);
@@ -127,7 +98,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testHostNotEquals() {
+ public void testHostNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
@@ -139,7 +110,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testMemberNotEquals() {
+ public void testMemberNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", null, "parent region", "child region");
ColocatedRegionDetails crd2 =
@@ -152,7 +123,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testParentNotEquals() {
+ public void testParentNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", null, "child region");
ColocatedRegionDetails crd2 =
@@ -165,7 +136,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testChildNotEquals() {
+ public void testChildNotEquals() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", "parent region", null);
ColocatedRegionDetails crd2 =
@@ -178,7 +149,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testClassInequality() {
+ public void testClassInequality() {
ColocatedRegionDetails crd1 =
new ColocatedRegionDetails("host", "member1", "parent region", null);
String crd2 = crd1.toString();
@@ -187,7 +158,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void nullColocatedRegionDetailsEqualsTests() {
+ public void nullColocatedRegionDetailsEqualsTests() {
ColocatedRegionDetails crd1 = null;
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host", "member1", "parent region", "child1");
@@ -198,7 +169,7 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testToString() {
+ public void testToString() {
ColocatedRegionDetails crd =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
assertEquals("[host:host1, member:member name, parent:parent region, child:child region]",
@@ -206,13 +177,13 @@ public class ColocatedRegionDetailsJUnitTest {
}
@Test
- public final void testToStringOfEmptyColocatedRegionDetails() {
+ public void testToStringOfEmptyColocatedRegionDetails() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
assertEquals("[,,,]", crd.toString());
}
@Test
- public final void testHashCode() {
+ public void testHashCode() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 =
new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
new file mode 100644
index 0000000..f1847f4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DeposePrimaryBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DeposePrimaryBucketMessage mockDeposePrimaryBucketMessage =
+ mock(DeposePrimaryBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ when(mockDeposePrimaryBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+ assertThat(mockDeposePrimaryBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
new file mode 100644
index 0000000..4cf44e4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessageTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class FetchEntryMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FetchEntryMessage mockFetchEntryMessage = mock(FetchEntryMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockFetchEntryMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ mockFetchEntryMessage.setKey(key);
+
+ verify(mockFetchEntryMessage, times(1)).setKey(key);
+
+ assertThat(mockFetchEntryMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
new file mode 100644
index 0000000..921017a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessageTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class FetchPartitionDetailsMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FetchPartitionDetailsMessage mockFetchPartitionDetailsMessage =
+ mock(FetchPartitionDetailsMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockFetchPartitionDetailsMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockFetchPartitionDetailsMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
new file mode 100644
index 0000000..2c37cc8
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MoveBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ MoveBucketMessage mockMoveBucketMessage = mock(MoveBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockMoveBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockMoveBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
index b3bb02b..01099d3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PartitionMessageTest.java
@@ -14,18 +14,17 @@
*/
package org.apache.geode.internal.cache.partitioned;
-import static org.mockito.Mockito.*;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.mockito.internal.stubbing.answers.CallsRealMethods;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.query.QueryException;
import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.DataLocationException;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.PartitionedRegion;
@@ -34,7 +33,12 @@ import org.apache.geode.internal.cache.TXStateProxy;
import org.apache.geode.internal.cache.TXStateProxyImpl;
import org.apache.geode.test.fake.Fakes;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.internal.stubbing.answers.CallsRealMethods;
+import java.io.IOException;
@Category(UnitTest.class)
public class PartitionMessageTest {
@@ -67,6 +71,17 @@ public class PartitionMessageTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ PartitionMessage mockPartitionMessage = mock(PartitionMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+
+ when(mockPartitionMessage.getMemberToMasqueradeAs()).thenReturn(mockInternalDistributedMember);
+
+ assertThat(mockPartitionMessage.getMemberToMasqueradeAs())
+ .isSameAs(mockInternalDistributedMember);
+ }
+
+ @Test
public void messageWithNoTXPerformsOnRegion() throws InterruptedException, CacheException,
QueryException, DataLocationException, IOException {
when(txMgr.masqueradeAs(msg)).thenReturn(null);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
new file mode 100644
index 0000000..92b1d2d
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessageTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoveAllPRMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoveAllPRMessage mockRemoveAllPRMessage = mock(RemoveAllPRMessage.class);
+ StringBuilder stringBuilder = new StringBuilder();
+
+ mockRemoveAllPRMessage.appendFields(stringBuilder);
+
+ verify(mockRemoveAllPRMessage, times(1)).appendFields(stringBuilder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
new file mode 100644
index 0000000..3b18079
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class RemoveBucketMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RemoveBucketMessage mockRemoveBucketMessage = mock(RemoveBucketMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ PartitionedRegion mockPartitionedRegion = mock(PartitionedRegion.class);
+ long startTime = System.currentTimeMillis();
+ Object key = new Object();
+
+ when(mockRemoveBucketMessage.operateOnPartitionedRegion(eq(mockDistributionManager),
+ eq(mockPartitionedRegion), eq(startTime))).thenReturn(true);
+
+ assertThat(mockRemoveBucketMessage.operateOnPartitionedRegion(mockDistributionManager,
+ mockPartitionedRegion, startTime)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
new file mode 100644
index 0000000..da3b94b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/SizeMessageTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.partitioned;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class SizeMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ SizeMessage mockSizeMessage = mock(SizeMessage.class);
+ when(mockSizeMessage.failIfRegionMissing()).thenReturn(true);
+ assertThat(mockSizeMessage.failIfRegionMissing()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
new file mode 100644
index 0000000..e7d918d
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CCUStatsTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.internal.cache.tier.sockets.CacheClientUpdater.CCUStats;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CCUStatsTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CCUStats mockCCUStats = mock(CCUStats.class);
+
+ mockCCUStats.incReceivedBytes(1L);
+ mockCCUStats.incSentBytes(1L);
+
+ verify(mockCCUStats, times(1)).incReceivedBytes(1L);
+ verify(mockCCUStats, times(1)).incSentBytes(1L);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
new file mode 100644
index 0000000..5720357
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/PartTest.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+@Category(UnitTest.class)
+public class PartTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Part mockPart = mock(Part.class);
+ OutputStream mockOutputStream = mock(OutputStream.class);
+ ByteBuffer mockByteBuffer = mock(ByteBuffer.class);
+
+ mockPart.writeTo(mockOutputStream, mockByteBuffer);
+
+ verify(mockPart, times(1)).writeTo(mockOutputStream, mockByteBuffer);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
index 0514e19..24b53f0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java
@@ -49,7 +49,7 @@ public class RegionVersionHolderJUnitTest {
RegionVersionHolder.BIT_SET_WIDTH = originalBitSetWidth;
}
- protected final InternalDistributedMember member() {
+ protected InternalDistributedMember member() {
return member;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
index e178708..cb03cbe 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
@@ -84,7 +84,7 @@ public class TombstoneDUnitTest extends JUnit4CacheTestCase {
}
}
- private final void createRegion(String regionName, boolean persistent) {
+ private void createRegion(String regionName, boolean persistent) {
if (persistent) {
getCache().createRegionFactory(RegionShortcut.REPLICATE_PERSISTENT).create(regionName);
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
index 5d4fd98..6fe7ee9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java
@@ -1580,7 +1580,7 @@ public class AsyncEventQueueTestBase extends JUnit4DistributedTestCase {
}
@Override
- public final Properties getDistributedSystemProperties() {
+ public Properties getDistributedSystemProperties() {
// For now all WANTestBase tests allocate off-heap memory even though
// many of them never use it.
// The problem is that WANTestBase has static methods that create instances
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
index 049513b..b21ca90 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
@@ -118,7 +118,7 @@ public class AsyncEventQueueValidationsJUnitTest {
.until(() -> filter.getAfterAcknowledgementInvocations() == numPuts);
}
- private final Object[] getCacheXmlFileBaseNames() {
+ private Object[] getCacheXmlFileBaseNames() {
return $(new Object[] {"testSerialAsyncEventQueueConfiguredFromXmlUsesFilter"},
new Object[] {"testParallelAsyncEventQueueConfiguredFromXmlUsesFilter"});
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
new file mode 100644
index 0000000..2d52783
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/wan/serial/DestroyMessageTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.wan.serial;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.internal.cache.DistributedRegion;
+import org.apache.geode.internal.cache.InternalCacheEvent;
+import org.apache.geode.internal.cache.wan.serial.BatchDestroyOperation.DestroyMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DestroyMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DestroyMessage mockDestroyMessageX = mock(DestroyMessage.class);
+ InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+
+ when(mockDestroyMessageX.createEvent(eq(mockDistributedRegion)))
+ .thenReturn(mockInternalCacheEvent);
+
+ assertThat(mockDestroyMessageX.createEvent(mockDistributedRegion))
+ .isSameAs(mockInternalCacheEvent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
new file mode 100644
index 0000000..f89622b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreationTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.xmlcache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.cache.TransactionListener;
+import org.apache.geode.cache.TransactionWriter;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CacheTransactionManagerCreationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CacheTransactionManagerCreation mockCacheTransactionManagerCreation =
+ mock(CacheTransactionManagerCreation.class);
+ TransactionListener mockTransactionListener = mock(TransactionListener.class);
+ TransactionWriter mockTransactionWriter = mock(TransactionWriter.class);
+
+ when(mockCacheTransactionManagerCreation.getListener()).thenReturn(mockTransactionListener);
+
+ mockCacheTransactionManagerCreation.setWriter(mockTransactionWriter);
+
+ verify(mockCacheTransactionManagerCreation, times(1)).setWriter(mockTransactionWriter);
+
+ assertThat(mockCacheTransactionManagerCreation.getListener()).isSameAs(mockTransactionListener);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
new file mode 100644
index 0000000..8142949
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2Test.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.xmlcache;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.xml.sax.InputSource;
+
+@Category(UnitTest.class)
+public class DefaultEntityResolver2Test {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DefaultEntityResolver2 mockDefaultEntityResolver2 = mock(DefaultEntityResolver2.class);
+ InputSource inputSource = new InputSource();
+
+ when(mockDefaultEntityResolver2.getClassPathInputSource(eq("publicId"), eq("systemId"),
+ eq("path"))).thenReturn(inputSource);
+
+ assertThat(mockDefaultEntityResolver2.getClassPathInputSource("publicId", "systemId", "path"))
+ .isSameAs(inputSource);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
index 66d72d8..67d12de 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/CacheJUnitTest.java
@@ -1170,7 +1170,7 @@ public class CacheJUnitTest {
this.tableName = str;
}
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
System.out.println("In Loader.load for" + helper.getKey());
return loadFromDatabase(helper.getKey());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
index 1585486..351c642 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/jta/functional/TestXACacheLoader.java
@@ -34,7 +34,7 @@ public class TestXACacheLoader implements CacheLoader {
public static String tableName = "";
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
System.out.println("In Loader.load for" + helper.getKey());
return loadFromDatabase(helper.getKey());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
index 5c7ccaa..7238664 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceJUnitTest.java
@@ -101,7 +101,7 @@ public class LogServiceJUnitTest {
}
@SuppressWarnings("unused")
- private static final Object[] getToLevelParameters() {
+ private static Object[] getToLevelParameters() {
return $(new Object[] {0, Level.OFF}, new Object[] {100, Level.FATAL},
new Object[] {200, Level.ERROR}, new Object[] {300, Level.WARN},
new Object[] {400, Level.INFO}, new Object[] {500, Level.DEBUG},
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
index 5717253..faf1f6a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/logging/log4j/AlertAppenderJUnitTest.java
@@ -70,7 +70,7 @@ public class AlertAppenderJUnitTest {
* Verify that adding/removing/replacing listeners works correctly.
*/
@Test
- public final void testListenerHandling() throws Exception {
+ public void testListenerHandling() throws Exception {
DistributedMember member1 = createTestDistributedMember("Member1");
DistributedMember member2 = createTestDistributedMember("Member2");
DistributedMember member3 = createTestDistributedMember("Member3");
@@ -146,7 +146,7 @@ public class AlertAppenderJUnitTest {
* when the configuration is changed the appender is still there.
*/
@Test
- public final void testAppenderToConfigHandling() throws Exception {
+ public void testAppenderToConfigHandling() throws Exception {
LogService.setBaseLogLevel(Level.WARN);
final String appenderName = AlertAppender.getInstance().getName();
[25/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
index 4bd4970..5631184 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
@@ -17,9 +17,7 @@ package org.apache.geode.internal.cache.tier.sockets;
import static org.apache.geode.distributed.ConfigurationProperties.*;
import java.io.BufferedOutputStream;
-import java.io.DataInput;
import java.io.DataInputStream;
-import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
@@ -70,12 +68,7 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.internal.DM;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.MessageWithReply;
-import org.apache.geode.distributed.internal.ReplyMessage;
-import org.apache.geode.distributed.internal.ReplyProcessor21;
import org.apache.geode.internal.ClassLoadUtil;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.statistics.DummyStatisticsFactory;
@@ -127,6 +120,22 @@ import org.apache.geode.security.AuthenticationRequiredException;
public class CacheClientNotifier {
private static final Logger logger = LogService.getLogger();
+ /**
+ * The size of the server-to-client communication socket buffers. This can be modified using the
+ * BridgeServer.SOCKET_BUFFER_SIZE system property.
+ */
+ private static final int socketBufferSize =
+ Integer.getInteger("BridgeServer.SOCKET_BUFFER_SIZE", 32768);
+
+ private static final long CLIENT_PING_TASK_PERIOD =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingPeriod", 60000);
+
+ /**
+ * package-private to avoid synthetic accessor
+ */
+ static final long CLIENT_PING_TASK_COUNTER =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingCounter", 3);
+
private static volatile CacheClientNotifier ccnSingleton;
/**
@@ -149,20 +158,6 @@ public class CacheClientNotifier {
private final Set<ClientProxyMembershipID> timedOutDurableClientProxies = new HashSet<>();
- /**
- * The GemFire {@code InternalCache}. Note that since this is a singleton class you should not use
- * a direct reference to cache in CacheClientNotifier code. Instead, you should always use
- * {@code getCache()}
- */
- private InternalCache cache; // TODO: fix synchronization of cache
-
- private InternalLogWriter logWriter;
-
- /**
- * The GemFire security {@code LogWriter}
- */
- private InternalLogWriter securityLogWriter;
-
/** the maximum number of messages that can be enqueued in a client-queue. */
private final int maximumMessageCount;
@@ -179,24 +174,9 @@ public class CacheClientNotifier {
private final CacheServerStats acceptorStats;
/**
- * haContainer can hold either the name of the client-messages-region (in case of eviction
- * policies "mem" or "entry") or an instance of HashMap (in case of eviction policy "none"). In
- * both the cases, it'll store HAEventWrapper as its key and ClientUpdateMessage as its value.
- */
- private volatile HAContainerWrapper haContainer;
-
- /**
- * The size of the server-to-client communication socket buffers. This can be modified using the
- * BridgeServer.SOCKET_BUFFER_SIZE system property.
- */
- private static final int socketBufferSize =
- Integer.getInteger("BridgeServer.SOCKET_BUFFER_SIZE", 32768);
-
- /**
* The statistics for this notifier
*/
- final CacheClientNotifierStats statistics; // TODO: pass statistics into CacheClientProxy then
- // make private
+ final CacheClientNotifierStats statistics; // TODO: pass statistics into CacheClientProxy
/**
* The {@code InterestRegistrationListener} instances registered in this VM. This is used when
@@ -209,55 +189,41 @@ public class CacheClientNotifier {
* provide a read-only {@code Set} of listeners.
*/
private final Set readableInterestRegistrationListeners =
- Collections.unmodifiableSet(this.writableInterestRegistrationListeners);
-
- /**
- * System property name for indicating how much frequently the "Queue full" message should be
- * logged.
- */
- private static final String MAX_QUEUE_LOG_FREQUENCY =
- DistributionConfig.GEMFIRE_PREFIX + "logFrequency.clientQueueReachedMaxLimit";
+ Collections.unmodifiableSet(this.writableInterestRegistrationListeners);
- public static final long DEFAULT_LOG_FREQUENCY = 1000;
+ private final Map<String, DefaultQuery> compiledQueries = new ConcurrentHashMap<>();
- private static final String EVENT_ENQUEUE_WAIT_TIME_NAME =
- DistributionConfig.GEMFIRE_PREFIX + "subscription.EVENT_ENQUEUE_WAIT_TIME";
+ private final Object lockIsCompiledQueryCleanupThreadStarted = new Object();
- private static final int DEFAULT_EVENT_ENQUEUE_WAIT_TIME = 100;
+ private final SocketCloser socketCloser;
- /**
- * System property value denoting the time in milliseconds. Any thread putting an event into a
- * subscription queue, which is full, will wait this much time for the queue to make space. It'll
- * then enque the event possibly causing the queue to grow beyond its capacity/max-size. See
- * #51400.
- */
- public static int eventEnqueueWaitTime; // TODO: encapsulate eventEnqueueWaitTime
+ /** package-private to avoid synthetic accessor */
+ final Set blackListedClients = new CopyOnWriteArraySet();
/**
- * The frequency of logging the "Queue full" message.
+ * haContainer can hold either the name of the client-messages-region (in case of eviction
+ * policies "mem" or "entry") or an instance of HashMap (in case of eviction policy "none"). In
+ * both the cases, it'll store HAEventWrapper as its key and ClientUpdateMessage as its value.
*/
- private long logFrequency = DEFAULT_LOG_FREQUENCY;
-
- private final Map<String, DefaultQuery> compiledQueries = new ConcurrentHashMap<>();
+ private volatile HAContainerWrapper haContainer;
private volatile boolean isCompiledQueryCleanupThreadStarted = false;
- private final Object lockIsCompiledQueryCleanupThreadStarted = new Object();
-
- private SystemTimer.SystemTimerTask clientPingTask; // TODO: fix synchronization of clientPingTask
-
- private final SocketCloser socketCloser;
+ /**
+ * The GemFire {@code InternalCache}. Note that since this is a singleton class you should not use
+ * a direct reference to cache in CacheClientNotifier code. Instead, you should always use
+ * {@code getCache()}
+ */
+ private InternalCache cache; // TODO: fix synchronization of cache
- private static final long CLIENT_PING_TASK_PERIOD =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingPeriod", 60000);
+ private InternalLogWriter logWriter;
/**
- * package-private to avoid synthetic accessor
+ * The GemFire security {@code LogWriter}
*/
- static final long CLIENT_PING_TASK_COUNTER =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingCounter", 3);
+ private InternalLogWriter securityLogWriter;
- private final Set blackListedClients = new CopyOnWriteArraySet();
+ private SystemTimer.SystemTimerTask clientPingTask; // TODO: fix synchronization of clientPingTask
/**
* Factory method to construct a CacheClientNotifier {@code CacheClientNotifier} instance.
@@ -319,21 +285,6 @@ public class CacheClientNotifier {
}
this.statistics = new CacheClientNotifierStats(factory);
- try {
- this.logFrequency = Long.valueOf(System.getProperty(MAX_QUEUE_LOG_FREQUENCY));
- if (this.logFrequency <= 0) {
- this.logFrequency = DEFAULT_LOG_FREQUENCY;
- }
- } catch (Exception e) {
- this.logFrequency = DEFAULT_LOG_FREQUENCY;
- }
-
- eventEnqueueWaitTime =
- Integer.getInteger(EVENT_ENQUEUE_WAIT_TIME_NAME, DEFAULT_EVENT_ENQUEUE_WAIT_TIME);
- if (eventEnqueueWaitTime < 0) {
- eventEnqueueWaitTime = DEFAULT_EVENT_ENQUEUE_WAIT_TIME;
- }
-
// Schedule task to periodically ping clients.
scheduleClientPingTask();
}
@@ -923,7 +874,7 @@ public class CacheClientNotifier {
* in it that determines which clients will receive the event.
*/
public static void notifyClients(InternalCacheEvent event) {
- CacheClientNotifier instance = ccnSingleton;
+ CacheClientNotifier instance = getInstance();
if (instance != null) {
instance.singletonNotifyClients(event, null);
}
@@ -935,7 +886,7 @@ public class CacheClientNotifier {
*/
public static void notifyClients(InternalCacheEvent event,
ClientUpdateMessage clientUpdateMessage) {
- CacheClientNotifier instance = ccnSingleton;
+ CacheClientNotifier instance = getInstance();
if (instance != null) {
instance.singletonNotifyClients(event, clientUpdateMessage);
}
@@ -1094,7 +1045,7 @@ public class CacheClientNotifier {
* interest established, or override the isClientInterested method to implement its own routing
*/
public static void routeClientMessage(Conflatable clientMessage) {
- CacheClientNotifier instance = ccnSingleton;
+ CacheClientNotifier instance = getInstance();
if (instance != null) {
// ok to use keySet here because all we do is call getClientProxy with these keys
instance.singletonRouteClientMessage(clientMessage, instance.clientProxies.keySet());
@@ -1106,7 +1057,7 @@ public class CacheClientNotifier {
*/
static void routeSingleClientMessage(ClientUpdateMessage clientMessage,
ClientProxyMembershipID clientProxyMembershipId) {
- CacheClientNotifier instance = ccnSingleton;
+ CacheClientNotifier instance = getInstance();
if (instance != null) {
instance.singletonRouteClientMessage(clientMessage,
Collections.singleton(clientProxyMembershipId));
@@ -1589,7 +1540,7 @@ public class CacheClientNotifier {
}
}
- if (noActiveServer() && ccnSingleton != null) {
+ if (noActiveServer() && getInstance() != null) {
ccnSingleton = null;
if (this.haContainer != null) {
this.haContainer.cleanUp();
@@ -1814,7 +1765,7 @@ public class CacheClientNotifier {
/**
* Shuts down durable client proxy
*/
- public boolean closeDurableClientProxy(String durableClientId) throws CacheException {
+ public boolean closeDurableClientProxy(String durableClientId) {
CacheClientProxy ccp = getClientProxy(durableClientId);
if (ccp == null) {
return false;
@@ -1828,8 +1779,7 @@ public class CacheClientNotifier {
if (logger.isDebugEnabled()) {
logger.debug("Cannot close running durable client: {}", durableClientId);
}
- // TODO: never throw an anonymous inner class
- throw new CacheException("Cannot close a running durable client : " + durableClientId) {};
+ throw new IllegalStateException("Cannot close a running durable client : " + durableClientId);
}
}
@@ -2114,10 +2064,6 @@ public class CacheClientNotifier {
CLIENT_PING_TASK_PERIOD, CLIENT_PING_TASK_PERIOD);
}
- public long getLogFrequency() {
- return this.logFrequency;
- }
-
/**
* @return the haContainer
*/
@@ -2182,93 +2128,4 @@ public class CacheClientNotifier {
}
}
- /**
- * Static inner-class ServerInterestRegistrationMessage
- * <p>
- * this message is used to send interest registration to another server. Since interest
- * registration performs a state-flush operation this message must not transmitted on an ordered
- * socket
- */
- public static class ServerInterestRegistrationMessage extends HighPriorityDistributionMessage
- implements MessageWithReply {
-
- ClientProxyMembershipID clientId;
- ClientInterestMessageImpl clientMessage;
- int processorId;
-
- ServerInterestRegistrationMessage(ClientProxyMembershipID clientID,
- ClientInterestMessageImpl msg) {
- this.clientId = clientID;
- this.clientMessage = msg;
- }
-
- public ServerInterestRegistrationMessage() {
- // nothing
- }
-
- static void sendInterestChange(DM dm, ClientProxyMembershipID clientID,
- ClientInterestMessageImpl msg) {
- ServerInterestRegistrationMessage registrationMessage =
- new ServerInterestRegistrationMessage(clientID, msg);
- Set recipients = dm.getOtherDistributionManagerIds();
- registrationMessage.setRecipients(recipients);
- ReplyProcessor21 rp = new ReplyProcessor21(dm, recipients);
- registrationMessage.processorId = rp.getProcessorId();
- dm.putOutgoing(registrationMessage);
- try {
- rp.waitForReplies();
- } catch (InterruptedException ignore) {
- Thread.currentThread().interrupt();
- }
- }
-
- @Override
- protected void process(DistributionManager dm) {
- // Get the proxy for the proxy id
- try {
- CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance();
- if (clientNotifier != null) {
- CacheClientProxy proxy = clientNotifier.getClientProxy(this.clientId);
- // If this VM contains a proxy for the requested proxy id, forward the
- // message on to the proxy for processing
- if (proxy != null) {
- proxy.processInterestMessage(this.clientMessage);
- }
- }
- } finally {
- ReplyMessage reply = new ReplyMessage();
- reply.setProcessorId(this.processorId);
- reply.setRecipient(getSender());
- try {
- dm.putOutgoing(reply);
- } catch (CancelException ignore) {
- // can't send a reply, so ignore the exception
- }
- }
- }
-
- @Override
- public int getDSFID() {
- return SERVER_INTEREST_REGISTRATION_MESSAGE;
- }
-
- @Override
- public void toData(DataOutput out) throws IOException {
- super.toData(out);
- out.writeInt(this.processorId);
- InternalDataSerializer.invokeToData(this.clientId, out);
- InternalDataSerializer.invokeToData(this.clientMessage, out);
- }
-
- @Override
- public void fromData(DataInput in) throws IOException, ClassNotFoundException {
- super.fromData(in);
- this.processorId = in.readInt();
- this.clientId = new ClientProxyMembershipID();
- InternalDataSerializer.invokeFromData(this.clientId, in);
- this.clientMessage = new ClientInterestMessageImpl();
- InternalDataSerializer.invokeFromData(this.clientMessage, in);
- }
- }
}
-
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerInterestRegistrationMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerInterestRegistrationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerInterestRegistrationMessage.java
new file mode 100644
index 0000000..5860982
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerInterestRegistrationMessage.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.HighPriorityDistributionMessage;
+import org.apache.geode.distributed.internal.MessageWithReply;
+import org.apache.geode.distributed.internal.ReplyMessage;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.internal.InternalDataSerializer;
+
+/**
+ * Send interest registration to another server. Since interest registration performs a state-flush operation this message must not transmitted on an ordered socket.
+ * <p>
+ * Extracted from CacheClientNotifier
+ */
+public class ServerInterestRegistrationMessage extends HighPriorityDistributionMessage
+ implements MessageWithReply {
+
+ private ClientProxyMembershipID clientId;
+ private ClientInterestMessageImpl clientMessage;
+ private int processorId;
+
+ ServerInterestRegistrationMessage(ClientProxyMembershipID clientId, ClientInterestMessageImpl clientInterestMessage) {
+ this.clientId = clientId;
+ this.clientMessage = clientInterestMessage;
+ }
+
+ public ServerInterestRegistrationMessage() {
+ // deserializing in fromData
+ }
+
+ static void sendInterestChange(DM dm, ClientProxyMembershipID clientId, ClientInterestMessageImpl clientInterestMessage) {
+ ServerInterestRegistrationMessage registrationMessage =
+ new ServerInterestRegistrationMessage(clientId, clientInterestMessage);
+
+ Set recipients = dm.getOtherDistributionManagerIds();
+ registrationMessage.setRecipients(recipients);
+
+ ReplyProcessor21 replyProcessor = new ReplyProcessor21(dm, recipients);
+ registrationMessage.processorId = replyProcessor.getProcessorId();
+
+ dm.putOutgoing(registrationMessage);
+
+ try {
+ replyProcessor.waitForReplies();
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ @Override
+ protected void process(DistributionManager dm) {
+ // Get the proxy for the proxy id
+ try {
+ CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance();
+ if (clientNotifier != null) {
+ CacheClientProxy proxy = clientNotifier.getClientProxy(this.clientId);
+ // If this VM contains a proxy for the requested proxy id, forward the
+ // message on to the proxy for processing
+ if (proxy != null) {
+ proxy.processInterestMessage(this.clientMessage);
+ }
+ }
+ } finally {
+ ReplyMessage reply = new ReplyMessage();
+ reply.setProcessorId(this.processorId);
+ reply.setRecipient(getSender());
+ try {
+ dm.putOutgoing(reply);
+ } catch (CancelException ignore) {
+ // can't send a reply, so ignore the exception
+ }
+ }
+ }
+
+ @Override
+ public int getDSFID() {
+ return SERVER_INTEREST_REGISTRATION_MESSAGE;
+ }
+
+ @Override
+ public void toData(DataOutput out) throws IOException {
+ super.toData(out);
+ out.writeInt(this.processorId);
+ InternalDataSerializer.invokeToData(this.clientId, out);
+ InternalDataSerializer.invokeToData(this.clientMessage, out);
+ }
+
+ @Override
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ super.fromData(in);
+ this.processorId = in.readInt();
+ this.clientId = new ClientProxyMembershipID();
+ InternalDataSerializer.invokeFromData(this.clientId, in);
+ this.clientMessage = new ClientInterestMessageImpl();
+ InternalDataSerializer.invokeFromData(this.clientMessage, in);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
index 1b599e9..fb0bd50 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxEnum.java
@@ -39,29 +39,29 @@ public class AddPdxEnum extends BaseCommand {
private AddPdxEnum() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx id for enum request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int noOfParts = msg.getNumberOfParts();
+ int noOfParts = clientMessage.getNumberOfParts();
- EnumInfo enumInfo = (EnumInfo) msg.getPart(0).getObject();
- int enumId = msg.getPart(1).getInt();
+ EnumInfo enumInfo = (EnumInfo) clientMessage.getPart(0).getObject();
+ int enumId = clientMessage.getPart(1).getInt();
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
registry.addRemoteEnum(enumId, enumInfo);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
index 9b8302e..10a065c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/AddPdxType.java
@@ -39,33 +39,33 @@ public class AddPdxType extends BaseCommand {
private AddPdxType() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx id for type request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int noOfParts = msg.getNumberOfParts();
+ int noOfParts = clientMessage.getNumberOfParts();
- PdxType type = (PdxType) msg.getPart(0).getObject();
- int typeId = msg.getPart(1).getInt();
+ PdxType type = (PdxType) clientMessage.getPart(0).getObject();
+ int typeId = clientMessage.getPart(1).getInt();
// The native client needs this line
// because it doesn't set the type id on the
// client side.
type.setTypeId(typeId);
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
registry.addRemoteType(typeId, type);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
index 959430c..c9c5a9d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClearRegion.java
@@ -47,15 +47,15 @@ public class ClearRegion extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, callbackArgPart = null;
String regionName = null;
Object callbackArg = null;
Part eventPart = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
@@ -63,36 +63,36 @@ public class ClearRegion extends BaseCommand {
stats.incReadClearRegionRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- eventPart = msg.getPart(1);
+ regionNamePart = clientMessage.getPart(0);
+ eventPart = clientMessage.getPart(1);
// callbackArgPart = null; (redundant assignment)
- if (msg.getNumberOfParts() > 2) {
- callbackArgPart = msg.getPart(2);
+ if (clientMessage.getNumberOfParts() > 2) {
+ callbackArgPart = clientMessage.getPart(2);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
regionName = regionNamePart.getString();
if (logger.isDebugEnabled()) {
- logger.debug(servConn.getName() + ": Received clear region request (" + msg.getPayloadLength()
- + " bytes) from " + servConn.getSocketString() + " for region " + regionName);
+ logger.debug(serverConnection.getName() + ": Received clear region request (" + clientMessage.getPayloadLength()
+ + " bytes) from " + serverConnection.getSocketString() + " for region " + regionName);
}
// Process the clear region request
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ClearRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
String errMessage =
LocalizedStrings.ClearRegion_THE_INPUT_REGION_NAME_FOR_THE_CLEAR_REGION_REQUEST_IS_NULL
.toLocalizedString();
- writeErrorResponse(msg, MessageType.CLEAR_REGION_DATA_ERROR, errMessage, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.CLEAR_REGION_DATA_ERROR, errMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -100,35 +100,35 @@ public class ClearRegion extends BaseCommand {
if (region == null) {
String reason = LocalizedStrings.ClearRegion_WAS_NOT_FOUND_DURING_CLEAR_REGION_REGUEST
.toLocalizedString();
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
try {
// Clear the region
this.securityService.authorizeRegionWrite(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
RegionClearOperationContext clearContext =
authzRequest.clearAuthorize(regionName, callbackArg);
callbackArg = clearContext.getCallbackArg();
}
- region.basicBridgeClear(callbackArg, servConn.getProxyID(),
+ region.basicBridgeClear(callbackArg, serverConnection.getProxyID(),
true /* boolean from cache Client */, eventId);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If an exception occurs during the clear, preserve the connection
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -138,10 +138,10 @@ public class ClearRegion extends BaseCommand {
start = DistributionStats.getStatTime();
stats.incProcessClearRegionTime(start - oldStart);
}
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug(servConn.getName() + ": Sent clear region response for region " + regionName);
+ logger.debug(serverConnection.getName() + ": Sent clear region response for region " + regionName);
}
stats.incWriteClearRegionResponseTime(DistributionStats.getStatTime() - start);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
index d50e522..053ef8a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ClientReady.java
@@ -35,34 +35,34 @@ public class ClientReady extends BaseCommand {
private ClientReady() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CacheServerStats stats = servConn.getCacheServerStats();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CacheServerStats stats = serverConnection.getCacheServerStats();
{
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadClientReadyRequestTime(start - oldStart);
}
try {
- String clientHost = servConn.getSocketHost();
- int clientPort = servConn.getSocketPort();
+ String clientHost = serverConnection.getSocketHost();
+ int clientPort = serverConnection.getSocketPort();
if (logger.isDebugEnabled()) {
logger.debug("{}: Received client ready request ({} bytes) from {} on {}:{}",
- servConn.getName(), msg.getPayloadLength(), servConn.getProxyID(), clientHost,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getProxyID(), clientHost,
clientPort);
}
- servConn.getAcceptor().getCacheClientNotifier().readyForEvents(servConn.getProxyID());
+ serverConnection.getAcceptor().getCacheClientNotifier().readyForEvents(serverConnection.getProxyID());
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incProcessClientReadyTime(start - oldStart);
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug(servConn.getName() + ": Processed client ready request from "
- + servConn.getProxyID() + " on " + clientHost + ":" + clientPort);
+ logger.debug(serverConnection.getName() + ": Processed client ready request from "
+ + serverConnection.getProxyID() + " on " + clientHost + ":" + clientPort);
}
} finally {
stats.incWriteClientReadyResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
index 66045aa..378a322 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CloseConnection.java
@@ -39,43 +39,43 @@ public class CloseConnection extends BaseCommand {
private CloseConnection() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- CacheServerStats stats = servConn.getCacheServerStats();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ CacheServerStats stats = serverConnection.getCacheServerStats();
long oldStart = start;
- boolean respondToClient = servConn.getClientVersion().compareTo(Version.GFE_90) >= 0;
+ boolean respondToClient = serverConnection.getClientVersion().compareTo(Version.GFE_90) >= 0;
start = DistributionStats.getStatTime();
stats.incReadCloseConnectionRequestTime(start - oldStart);
if (respondToClient) {
// newer clients will wait for a response or EOFException
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
}
try {
- servConn.setClientDisconnectCleanly();
- String clientHost = servConn.getSocketHost();
- int clientPort = servConn.getSocketPort();
+ serverConnection.setClientDisconnectCleanly();
+ String clientHost = serverConnection.getSocketHost();
+ int clientPort = serverConnection.getSocketPort();
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received close request ({} bytes) from {}:{}", servConn.getName(),
- msg.getPayloadLength(), clientHost, clientPort);
+ logger.debug("{}: Received close request ({} bytes) from {}:{}", serverConnection.getName(),
+ clientMessage.getPayloadLength(), clientHost, clientPort);
}
- Part keepalivePart = msg.getPart(0);
+ Part keepalivePart = clientMessage.getPart(0);
byte[] keepaliveByte = keepalivePart.getSerializedForm();
boolean keepalive = (keepaliveByte == null || keepaliveByte[0] == 0) ? false : true;
- servConn.getAcceptor().getCacheClientNotifier().setKeepAlive(servConn.getProxyID(),
+ serverConnection.getAcceptor().getCacheClientNotifier().setKeepAlive(serverConnection.getProxyID(),
keepalive);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Processed close request from {}:{}, keepAlive: {}", servConn.getName(),
+ logger.debug("{}: Processed close request from {}:{}, keepAlive: {}", serverConnection.getName(),
clientHost, clientPort, keepalive);
}
} finally {
if (respondToClient) {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
- servConn.setFlagProcessMessagesAsFalse();
+ serverConnection.setFlagProcessMessagesAsFalse();
stats.incProcessCloseConnectionTime(DistributionStats.getStatTime() - start);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
index 55ef09b..b2bba4f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CommitCommand.java
@@ -50,12 +50,12 @@ public class CommitCommand extends BaseCommand {
private CommitCommand() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- TXManagerImpl txMgr = (TXManagerImpl) servConn.getCache().getCacheTransactionManager();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ TXManagerImpl txMgr = (TXManagerImpl) serverConnection.getCache().getCacheTransactionManager();
InternalDistributedMember client =
- (InternalDistributedMember) servConn.getProxyID().getDistributedMember();
- int uniqId = msg.getTransactionId();
+ (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember();
+ int uniqId = clientMessage.getTransactionId();
TXId txId = new TXId(client, uniqId);
TXCommitMessage commitMsg = null;
if (txMgr.isHostedTxRecentlyCompleted(txId)) {
@@ -64,11 +64,11 @@ public class CommitCommand extends BaseCommand {
logger.debug("TX: returning a recently committed txMessage for tx: {}", txId);
}
if (!txMgr.isExceptionToken(commitMsg)) {
- writeCommitResponse(commitMsg, msg, servConn);
+ writeCommitResponse(commitMsg, clientMessage, serverConnection);
commitMsg.setClientVersion(null); // fixes bug 46529
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
} else {
- sendException(msg, servConn, txMgr.getExceptionForToken(commitMsg, txId));
+ sendException(clientMessage, serverConnection, txMgr.getExceptionForToken(commitMsg, txId));
}
txMgr.removeHostedTXState(txId);
return;
@@ -87,10 +87,10 @@ public class CommitCommand extends BaseCommand {
txMgr.commit();
commitMsg = txProxy.getCommitMessage();
- writeCommitResponse(commitMsg, msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeCommitResponse(commitMsg, clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
- sendException(msg, servConn, e);
+ sendException(clientMessage, serverConnection, e);
} finally {
if (txId != null) {
txMgr.removeHostedTXState(txId);
@@ -115,7 +115,7 @@ public class CommitCommand extends BaseCommand {
if (response != null) {
response.setClientVersion(servConn.getClientVersion());
}
- responseMsg.addObjPart(response, zipValues);
+ responseMsg.addObjPart(response, false);
servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
if (logger.isDebugEnabled()) {
logger.debug("TX: sending a nonNull response for transaction: {}",
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
index c1b67e1..50d1197 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey.java
@@ -51,34 +51,34 @@ public class ContainsKey extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
Part regionNamePart = null;
Part keyPart = null;
String regionName = null;
Object key = null;
- CacheServerStats stats = servConn.getCacheServerStats();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadContainsKeyRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
regionName = regionNamePart.getString();
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received containsKey request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// Process the containsKey request
@@ -87,47 +87,47 @@ public class ContainsKey extends BaseCommand {
if (key == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage = LocalizedStrings.ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL
.toLocalizedString();
}
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage =
LocalizedStrings.ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL
.toLocalizedString();
}
- writeErrorResponse(msg, MessageType.CONTAINS_KEY_DATA_ERROR, errMessage, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.CONTAINS_KEY_DATA_ERROR, errMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason =
LocalizedStrings.ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST.toLocalizedString();
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
this.securityService.authorizeRegionRead(regionName, key.toString());
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
try {
authzRequest.containsKeyAuthorize(regionName, key);
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -140,10 +140,10 @@ public class ContainsKey extends BaseCommand {
start = DistributionStats.getStatTime();
stats.incProcessContainsKeyTime(start - oldStart);
}
- writeContainsKeyResponse(containsKey, msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeContainsKeyResponse(containsKey, clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent containsKey response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent containsKey response for region {} key {}", serverConnection.getName(),
regionName, key);
}
stats.incWriteContainsKeyResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
index dc8f9eb..53bb414 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ContainsKey66.java
@@ -55,34 +55,34 @@ public class ContainsKey66 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
Part regionNamePart = null, keyPart = null;
String regionName = null;
Object key = null;
ContainsKeyOp.MODE mode;
- CacheServerStats stats = servConn.getCacheServerStats();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadContainsKeyRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
- mode = ContainsKeyOp.MODE.values()[(msg.getPart(2).getInt())];
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
+ mode = ContainsKeyOp.MODE.values()[(clientMessage.getPart(2).getInt())];
regionName = regionNamePart.getString();
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received containsKey request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// Process the containsKey request
@@ -91,46 +91,46 @@ public class ContainsKey66 extends BaseCommand {
if (key == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ContainsKey_0_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage = LocalizedStrings.ContainsKey_THE_INPUT_KEY_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL
.toLocalizedString();
}
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ContainsKey_0_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage =
LocalizedStrings.ContainsKey_THE_INPUT_REGION_NAME_FOR_THE_CONTAINSKEY_REQUEST_IS_NULL
.toLocalizedString();
}
- writeErrorResponse(msg, MessageType.CONTAINS_KEY_DATA_ERROR, errMessage, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.CONTAINS_KEY_DATA_ERROR, errMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason =
LocalizedStrings.ContainsKey_WAS_NOT_FOUND_DURING_CONTAINSKEY_REQUEST.toLocalizedString();
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
this.securityService.authorizeRegionRead(regionName, key.toString());
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
try {
authzRequest.containsKeyAuthorize(regionName, key);
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -157,10 +157,10 @@ public class ContainsKey66 extends BaseCommand {
start = DistributionStats.getStatTime();
stats.incProcessContainsKeyTime(start - oldStart);
}
- writeContainsKeyResponse(containsKey, msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeContainsKeyResponse(containsKey, clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent containsKey response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent containsKey response for region {} key {}", serverConnection.getName(),
regionName, key);
}
stats.incWriteContainsKeyResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
index d84dc62..b7ab01b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/CreateRegion.java
@@ -41,25 +41,25 @@ public class CreateRegion extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
Part regionNamePart = null;
String regionName = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- Part parentRegionNamePart = msg.getPart(0);
+ Part parentRegionNamePart = clientMessage.getPart(0);
String parentRegionName = parentRegionNamePart.getString();
- regionNamePart = msg.getPart(1);
+ regionNamePart = clientMessage.getPart(1);
regionName = regionNamePart.getString();
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received create region request ({} bytes) from {} for parent region {} region {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), parentRegionName,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), parentRegionName,
regionName);
}
@@ -69,7 +69,7 @@ public class CreateRegion extends BaseCommand {
if (parentRegionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CreateRegion_0_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage =
LocalizedStrings.CreateRegion_THE_INPUT_PARENT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL
.toLocalizedString();
@@ -77,41 +77,41 @@ public class CreateRegion extends BaseCommand {
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CreateRegion_0_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage =
LocalizedStrings.CreateRegion_THE_INPUT_REGION_NAME_FOR_THE_CREATE_REGION_REQUEST_IS_NULL
.toLocalizedString();
}
- writeErrorResponse(msg, MessageType.CREATE_REGION_DATA_ERROR, errMessage, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.CREATE_REGION_DATA_ERROR, errMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Region parentRegion = servConn.getCache().getRegion(parentRegionName);
+ Region parentRegion = serverConnection.getCache().getRegion(parentRegionName);
if (parentRegion == null) {
String reason =
LocalizedStrings.CreateRegion__0_WAS_NOT_FOUND_DURING_SUBREGION_CREATION_REQUEST
.toLocalizedString(parentRegionName);
- writeRegionDestroyedEx(msg, parentRegionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, parentRegionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
this.securityService.authorizeDataManage();
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
try {
authzRequest.createRegionAuthorize(parentRegionName + '/' + regionName);
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -121,11 +121,11 @@ public class CreateRegion extends BaseCommand {
AttributesFactory factory = new AttributesFactory(parentRegion.getAttributes());
region = parentRegion.createSubregion(regionName, factory.create());
if (logger.isDebugEnabled()) {
- logger.debug("{}: Created region {}", servConn.getName(), region);
+ logger.debug("{}: Created region {}", serverConnection.getName(), region);
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("{}: Retrieved region {}", servConn.getName(), region);
+ logger.debug("{}: Retrieved region {}", serverConnection.getName(), region);
}
}
@@ -134,11 +134,11 @@ public class CreateRegion extends BaseCommand {
// NOT USING IT
// bserverStats.incLong(processDestroyTimeId,
// DistributionStats.getStatTime() - start);
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sent create region response for parent region {} region {}",
- servConn.getName(), parentRegionName, regionName);
+ serverConnection.getName(), parentRegionName, regionName);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
index 1497044..359e1b4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Default.java
@@ -37,14 +37,15 @@ public class Default extends BaseCommand {
private Default() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
// requiresResponse = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE
logger.fatal(
LocalizedMessage.create(LocalizedStrings.Default_0_UNKNOWN_MESSAGE_TYPE_1_WITH_TX_2_FROM_3,
- new Object[] {servConn.getName(), MessageType.getString(msg.getMessageType()),
- Integer.valueOf(msg.getTransactionId()), servConn.getSocketString()}));
- writeErrorResponse(msg, MessageType.UNKNOWN_MESSAGE_TYPE_ERROR, servConn);
+ new Object[] {
+ serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
+ Integer.valueOf(clientMessage.getTransactionId()), serverConnection.getSocketString()}));
+ writeErrorResponse(clientMessage, MessageType.UNKNOWN_MESSAGE_TYPE_ERROR, serverConnection);
// responded = true; NOT NEEDED... ALWAYS SEND ERROR RESPONSE
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
index 5996984..0699c8b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy.java
@@ -48,7 +48,7 @@ public class Destroy extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long startparam)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startparam)
throws IOException, InterruptedException {
long start = startparam;
@@ -57,8 +57,8 @@ public class Destroy extends BaseCommand {
Object callbackArg = null, key = null;
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
@@ -66,17 +66,17 @@ public class Destroy extends BaseCommand {
stats.incReadDestroyRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
- eventPart = msg.getPart(2);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
+ eventPart = clientMessage.getPart(2);
// callbackArgPart = null; (redundant assignment)
- if (msg.getNumberOfParts() > 3) {
- callbackArgPart = msg.getPart(3);
+ if (clientMessage.getNumberOfParts() > 3) {
+ callbackArgPart = clientMessage.getPart(3);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -84,13 +84,13 @@ public class Destroy extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received destroy request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// Process the destroy request
@@ -98,29 +98,29 @@ public class Destroy extends BaseCommand {
if (key == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage.append(LocalizedStrings.Destroy__THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL
.toLocalizedString());
}
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage
.append(LocalizedStrings.Destroy__THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL
.toLocalizedString());
}
- writeErrorResponse(msg, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.Destroy__0_WAS_NOT_FOUND_DURING_DESTROY_REQUEST
.toLocalizedString(regionName);
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -128,13 +128,13 @@ public class Destroy extends BaseCommand {
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
try {
// for integrated security
this.securityService.authorizeRegionWrite(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegionDestroyOperationContext destroyContext =
@@ -146,35 +146,35 @@ public class Destroy extends BaseCommand {
callbackArg = destroyContext.getCallbackArg();
}
}
- region.basicBridgeDestroy(key, callbackArg, servConn.getProxyID(), true,
+ region.basicBridgeDestroy(key, callbackArg, serverConnection.getProxyID(), true,
new EventIDHolder(eventId));
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} catch (EntryNotFoundException e) {
// Don't send an exception back to the client if this
// exception happens. Just log it and continue.
logger.info(LocalizedMessage.create(
LocalizedStrings.Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1,
- new Object[] {servConn.getName(), key}));
+ new Object[] { serverConnection.getName(), key}));
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If an exception occurs during the destroy, preserve the connection
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (e instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), e);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.Destroy_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
}
return;
}
@@ -188,17 +188,17 @@ public class Destroy extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
} else {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
} else {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent destroy response for region {} key {}", servConn.getName(), regionName,
+ logger.debug("{}: Sent destroy response for region {} key {}", serverConnection.getName(), regionName,
key);
}
stats.incWriteDestroyResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy65.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy65.java
index 585f57d..0ee0fc4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy65.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy65.java
@@ -54,7 +54,7 @@ public class Destroy65 extends BaseCommand {
}
@Override
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
throw new UnsupportedOperationException();
}
@@ -72,7 +72,7 @@ public class Destroy65 extends BaseCommand {
replyMsg.addIntPart(entryNotFoundForRemove ? 1 : 0);
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
@@ -84,7 +84,7 @@ public class Destroy65 extends BaseCommand {
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(2);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
+ replyMsg.addBytesPart(okBytes());
replyMsg.addIntPart(entryNotFound ? 1 : 0);
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
@@ -94,7 +94,7 @@ public class Destroy65 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart;
Part keyPart;
@@ -108,20 +108,20 @@ public class Destroy65 extends BaseCommand {
String regionName = null;
Object callbackArg = null, key = null;
StringBuffer errMessage = new StringBuffer();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
long now = DistributionStats.getStatTime();
stats.incReadDestroyRequestTime(now - start);
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
- expectedOldValuePart = msg.getPart(2);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
+ expectedOldValuePart = clientMessage.getPart(2);
try {
- operation = msg.getPart(3).getObject();
+ operation = clientMessage.getPart(3).getObject();
if (((operation instanceof Operation) && ((Operation) operation == Operation.REMOVE))
|| ((operation instanceof Byte) && (Byte) operation == OpType.DESTROY))
@@ -130,20 +130,20 @@ public class Destroy65 extends BaseCommand {
expectedOldValue = expectedOldValuePart.getObject();
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- eventPart = msg.getPart(4);
+ eventPart = clientMessage.getPart(4);
- if (msg.getNumberOfParts() > 5) {
- callbackArgPart = msg.getPart(5);
+ if (clientMessage.getNumberOfParts() > 5) {
+ callbackArgPart = clientMessage.getPart(5);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -151,16 +151,16 @@ public class Destroy65 extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received destroy65 request ({} bytes; op={}) from {} for region {} key {}{} txId {}",
- servConn.getName(), msg.getPayloadLength(), operation, servConn.getSocketString(),
+ serverConnection.getName(), clientMessage.getPayloadLength(), operation, serverConnection.getSocketString(),
regionName, key, (operation == Operation.REMOVE ? " value=" + expectedOldValue : ""),
- msg.getTransactionId());
+ clientMessage.getTransactionId());
}
boolean entryNotFoundForRemove = false;
@@ -169,29 +169,29 @@ public class Destroy65 extends BaseCommand {
if (key == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.Destroy_0_THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage.append(LocalizedStrings.Destroy__THE_INPUT_KEY_FOR_THE_DESTROY_REQUEST_IS_NULL
.toLocalizedString());
}
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.Destroy_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage
.append(LocalizedStrings.Destroy__THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REQUEST_IS_NULL
.toLocalizedString());
}
- writeErrorResponse(msg, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.Destroy__0_WAS_NOT_FOUND_DURING_DESTROY_REQUEST
.toLocalizedString(regionName);
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -199,13 +199,13 @@ public class Destroy65 extends BaseCommand {
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
EventIDHolder clientEvent = new EventIDHolder(eventId);
Breadcrumbs.setEventId(eventId);
// msg.isRetry might be set by v7.0 and later clients
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// if (logger.isDebugEnabled()) {
// logger.debug("DEBUG: encountered isRetry in Destroy65");
// }
@@ -223,7 +223,7 @@ public class Destroy65 extends BaseCommand {
// for integrated security
this.securityService.authorizeRegionWrite(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegionDestroyOperationContext destroyContext =
@@ -236,14 +236,14 @@ public class Destroy65 extends BaseCommand {
}
}
if (operation == null || operation == Operation.DESTROY) {
- region.basicBridgeDestroy(key, callbackArg, servConn.getProxyID(), true, clientEvent);
+ region.basicBridgeDestroy(key, callbackArg, serverConnection.getProxyID(), true, clientEvent);
} else {
// this throws exceptions if expectedOldValue checks fail
try {
if (expectedOldValue == null) {
expectedOldValue = Token.INVALID;
}
- if (operation == Operation.REMOVE && msg.isRetry()
+ if (operation == Operation.REMOVE && clientMessage.isRetry()
&& clientEvent.getVersionTag() != null) {
// the operation was successful last time it was tried, so there's
// no need to perform it again. Just return the version tag and
@@ -254,55 +254,55 @@ public class Destroy65 extends BaseCommand {
}
// try the operation anyway to ensure that it's been distributed to all servers
try {
- region.basicBridgeRemove(key, expectedOldValue, callbackArg, servConn.getProxyID(),
+ region.basicBridgeRemove(key, expectedOldValue, callbackArg, serverConnection.getProxyID(),
true, clientEvent);
} catch (EntryNotFoundException e) {
// ignore, and don't set entryNotFoundForRemove because this was a successful
// operation - bug #51664
}
} else {
- region.basicBridgeRemove(key, expectedOldValue, callbackArg, servConn.getProxyID(),
+ region.basicBridgeRemove(key, expectedOldValue, callbackArg, serverConnection.getProxyID(),
true, clientEvent);
if (logger.isDebugEnabled()) {
logger.debug("region.remove succeeded");
}
}
} catch (EntryNotFoundException e) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
if (logger.isDebugEnabled()) {
logger.debug("writing entryNotFound response");
}
entryNotFoundForRemove = true;
}
}
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} catch (EntryNotFoundException e) {
// Don't send an exception back to the client if this
// exception happens. Just log it and continue.
logger.info(LocalizedMessage.create(
LocalizedStrings.Destroy_0_DURING_ENTRY_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1,
- new Object[] {servConn.getName(), key}));
+ new Object[] { serverConnection.getName(), key}));
entryNotFoundForRemove = true;
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If an exception occurs during the destroy, preserve the connection
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (e instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), e);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.Destroy_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
}
return;
}
@@ -314,20 +314,20 @@ public class Destroy65 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, entryNotFoundForRemove,
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, entryNotFoundForRemove,
pr.getNetworkHopType(), clientEvent.getVersionTag());
pr.clearNetworkHopData();
} else {
- writeReply(msg, servConn, entryNotFoundForRemove | clientEvent.getIsRedestroyedEntry(),
+ writeReply(clientMessage, serverConnection, entryNotFoundForRemove | clientEvent.getIsRedestroyedEntry(),
clientEvent.getVersionTag());
}
} else {
- writeReply(msg, servConn, entryNotFoundForRemove | clientEvent.getIsRedestroyedEntry(),
+ writeReply(clientMessage, serverConnection, entryNotFoundForRemove | clientEvent.getIsRedestroyedEntry(),
clientEvent.getVersionTag());
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent destroy response for region {} key {}", servConn.getName(), regionName,
+ logger.debug("{}: Sent destroy response for region {} key {}", serverConnection.getName(), regionName,
key);
}
stats.incWriteDestroyResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy70.java
index 59a7233..7c07c72 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Destroy70.java
@@ -67,7 +67,7 @@ public class Destroy70 extends Destroy65 {
pr.getPrStats().incPRMetaDataSentCount();
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
@@ -104,7 +104,7 @@ public class Destroy70 extends Destroy65 {
// logger.fine("response has no version tag");
// }
}
- replyMsg.addBytesPart(OK_BYTES); // make old single-hop code happy by puting byte[]{0} here
+ replyMsg.addBytesPart(okBytes()); // make old single-hop code happy by puting byte[]{0} here
replyMsg.addIntPart(entryNotFound ? 1 : 0);
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
[09/28] geode git commit: GEODE-1930: temporarily disable
verifySystemNotifications
Posted by kl...@apache.org.
GEODE-1930: temporarily disable verifySystemNotifications
* verifySystemNotifications is very flaky and we need to
determine what async state to Await for
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/88631957
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/88631957
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/88631957
Branch: refs/heads/feature/GEODE-2632-16
Commit: 88631957e9bc570115ed150eceed9a1b8b470a01
Parents: d16d192
Author: Kirk Lund <kl...@apache.org>
Authored: Thu May 18 14:57:26 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:17:39 2017 -0700
----------------------------------------------------------------------
.../org/apache/geode/management/RegionManagementDUnitTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/88631957/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
index 7dabd61..cb35663 100644
--- a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
@@ -258,7 +258,8 @@ public class RegionManagementDUnitTest extends ManagementTestBase {
closeRegion(this.managerVM, REGION_PATH);
verifyDistributedMBean(this.managerVM, 0);
- verifySystemNotifications(this.managerVM, REGION_NAME, 3);
+ // TODO: GEODE-1930: next line is too flaky and needs to be fixed
+ // verifySystemNotifications(this.managerVM, REGION_NAME, 3);
}
@Test
[05/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
index 7a2d33d..b6c11c4 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -41,6 +41,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_ARC
import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION;
import static org.apache.geode.management.internal.cli.i18n.CliStrings.START_SERVER__PASSWORD;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.geode.GemFireException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.server.CacheServer;
@@ -188,62 +189,46 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true,
relatedTopic = {CliStrings.TOPIC_GEODE_LOCATOR, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startLocator(
- @CliOption(key = CliStrings.START_LOCATOR__MEMBER_NAME, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.START_LOCATOR__MEMBER_NAME,
help = CliStrings.START_LOCATOR__MEMBER_NAME__HELP) String memberName,
@CliOption(key = CliStrings.START_LOCATOR__BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__BIND_ADDRESS__HELP) final String bindAddress,
@CliOption(key = CliStrings.START_LOCATOR__CLASSPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__CLASSPATH__HELP) final String classpath,
@CliOption(key = CliStrings.START_LOCATOR__FORCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_LOCATOR__FORCE__HELP) final Boolean force,
@CliOption(key = CliStrings.START_LOCATOR__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__GROUP__HELP) final String group,
@CliOption(key = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS__HELP) final String hostnameForClients,
@CliOption(key = CliStrings.START_LOCATOR__INCLUDE_SYSTEM_CLASSPATH,
specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = CliStrings.START_LOCATOR__INCLUDE_SYSTEM_CLASSPATH__HELP) final Boolean includeSystemClasspath,
@CliOption(key = CliStrings.START_LOCATOR__LOCATORS,
optionContext = ConverterHint.LOCATOR_DISCOVERY_CONFIG,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__LOCATORS__HELP) final String locators,
@CliOption(key = CliStrings.START_LOCATOR__LOG_LEVEL, optionContext = ConverterHint.LOG_LEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__LOG_LEVEL__HELP) final String logLevel,
@CliOption(key = CliStrings.START_LOCATOR__MCAST_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MCAST_ADDRESS__HELP) final String mcastBindAddress,
@CliOption(key = CliStrings.START_LOCATOR__MCAST_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MCAST_PORT__HELP) final Integer mcastPort,
@CliOption(key = CliStrings.START_LOCATOR__PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__PORT__HELP) final Integer port,
@CliOption(key = CliStrings.START_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__DIR__HELP) String workingDirectory,
@CliOption(key = CliStrings.START_LOCATOR__PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__PROPERTIES__HELP) String gemfirePropertiesPathname,
@CliOption(key = CliStrings.START_LOCATOR__SECURITY_PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__SECURITY_PROPERTIES__HELP) String gemfireSecurityPropertiesPathname,
@CliOption(key = CliStrings.START_LOCATOR__INITIALHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__INITIALHEAP__HELP) final String initialHeap,
@CliOption(key = CliStrings.START_LOCATOR__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__MAXHEAP__HELP) final String maxHeap,
@CliOption(key = CliStrings.START_LOCATOR__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__J__HELP) final String[] jvmArgsOpts,
@CliOption(key = CliStrings.START_LOCATOR__CONNECT, unspecifiedDefaultValue = "true",
specifiedDefaultValue = "true",
@@ -257,10 +242,8 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliOption(key = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR, unspecifiedDefaultValue = "",
help = CliStrings.START_LOCATOR__CLUSTER__CONFIG__DIR__HELP) final String clusterConfigDir,
@CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT__HELP) final Integer httpServicePort,
@CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP) final String httpServiceBindAddress) {
try {
if (StringUtils.isBlank(memberName)) {
@@ -272,17 +255,17 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
gemfirePropertiesPathname = CliUtil.resolvePathname(gemfirePropertiesPathname);
- if (!StringUtils.isBlank(gemfirePropertiesPathname)
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)
&& !IOUtils.isExistingPathname(gemfirePropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
- CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname));
+ CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+ gemfirePropertiesPathname));
}
gemfireSecurityPropertiesPathname =
CliUtil.resolvePathname(gemfireSecurityPropertiesPathname);
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)
&& !IOUtils.isExistingPathname(gemfireSecurityPropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
@@ -295,42 +278,41 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(GROUPS, StringUtils.valueOf(group, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATORS,
- StringUtils.valueOf(locators, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOG_LEVEL,
- StringUtils.valueOf(logLevel, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_ADDRESS,
- StringUtils.valueOf(mcastBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_PORT,
- StringUtils.valueOf(mcastPort, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(GROUPS, StringUtils.defaultString(group));
+ gemfireProperties.setProperty(LOCATORS, StringUtils.defaultString(locators));
+ gemfireProperties.setProperty(LOG_LEVEL, StringUtils.defaultString(logLevel));
+ gemfireProperties.setProperty(MCAST_ADDRESS, StringUtils.defaultString(mcastBindAddress));
+ gemfireProperties.setProperty(MCAST_PORT, StringUtils.defaultString(mcastPort));
gemfireProperties.setProperty(ENABLE_CLUSTER_CONFIGURATION,
- StringUtils.valueOf(enableSharedConfiguration, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(enableSharedConfiguration));
gemfireProperties.setProperty(LOAD_CLUSTER_CONFIGURATION_FROM_DIR,
- StringUtils.valueOf(loadSharedConfigurationFromDirectory, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(loadSharedConfigurationFromDirectory));
gemfireProperties.setProperty(CLUSTER_CONFIGURATION_DIR,
- StringUtils.valueOf(clusterConfigDir, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(HTTP_SERVICE_PORT,
- StringUtils.valueOf(httpServicePort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(clusterConfigDir));
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT, StringUtils.defaultString(httpServicePort));
gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS,
- StringUtils.valueOf(httpServiceBindAddress, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(httpServiceBindAddress));
// read the OSProcess enable redirect system property here -- TODO: replace with new GFSH
// argument
final boolean redirectOutput =
Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
- LocatorLauncher locatorLauncher =
- new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force)
- .setHostnameForClients(hostnameForClients).setMemberName(memberName).setPort(port)
- .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory).build();
+ LocatorLauncher.Builder locatorLauncherBuilder =
+ new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force).setPort(port)
+ .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory);
+ if (hostnameForClients != null) {
+ locatorLauncherBuilder.setHostnameForClients(hostnameForClients);
+ }
+ if (memberName != null) {
+ locatorLauncherBuilder.setMemberName(memberName);
+ }
+ LocatorLauncher locatorLauncher = locatorLauncherBuilder.build();
String[] locatorCommandLine = createStartLocatorCommandLine(locatorLauncher,
gemfirePropertiesPathname, gemfireSecurityPropertiesPathname, gemfireProperties,
classpath, includeSystemClasspath, jvmArgsOpts, initialHeap, maxHeap);
- // getGfsh().logInfo(StringUtils.concat(locatorCommandLine, " "), null);
-
final Process locatorProcess = new ProcessBuilder(locatorCommandLine)
.directory(new File(locatorLauncher.getWorkingDirectory())).start();
@@ -502,7 +484,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add(LocatorLauncher.class.getName());
commandLine.add(LocatorLauncher.Command.START.getName());
- if (!StringUtils.isBlank(launcher.getMemberName())) {
+ if (StringUtils.isNotBlank(launcher.getMemberName())) {
commandLine.add(launcher.getMemberName());
}
@@ -518,7 +500,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add("--force");
}
- if (!StringUtils.isBlank(launcher.getHostnameForClients())) {
+ if (StringUtils.isNotBlank(launcher.getHostnameForClients())) {
commandLine.add("--hostname-for-clients=" + launcher.getHostnameForClients());
}
@@ -615,7 +597,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
jmxManagerSslEnabled, infoResultData);
}
- if (!StringUtils.isBlank(responseFailureMessage)) {
+ if (StringUtils.isNotBlank(responseFailureMessage)) {
infoResultData.addLine("\n");
infoResultData.addLine(responseFailureMessage);
}
@@ -639,7 +621,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
message.append("Authentication");
}
if (jmxManagerSslEnabled) {
- message.append(jmxManagerAuthEnabled ? " and " : StringUtils.EMPTY_STRING)
+ message.append(jmxManagerAuthEnabled ? " and " : StringUtils.EMPTY)
.append("SSL configuration");
}
if (jmxManagerAuthEnabled || jmxManagerSslEnabled) {
@@ -657,7 +639,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
private Map<String, String> loadConfigurationProperties(
final String configurationPropertiesPathname, Map<String, String> configurationProperties) {
configurationProperties =
- (configurationProperties != null ? configurationProperties : new HashMap<String, String>());
+ (configurationProperties != null ? configurationProperties : new HashMap<>());
if (IOUtils.isExistingPathname(configurationPropertiesPathname)) {
try {
@@ -763,22 +745,17 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
public Result statusLocator(
@CliOption(key = CliStrings.STATUS_LOCATOR__MEMBER,
optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STATUS_LOCATOR__HOST,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__HOST__HELP) final String locatorHost,
@CliOption(key = CliStrings.STATUS_LOCATOR__PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__PORT__HELP) final Integer locatorPort,
@CliOption(key = CliStrings.STATUS_LOCATOR__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STATUS_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_LOCATOR__DIR__HELP) final String workingDirectory) {
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean locatorProxy = getMemberMXBean(member);
@@ -802,9 +779,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
final LocatorState state = locatorLauncher.status();
return createStatusLocatorResult(state);
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -824,18 +799,15 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
public Result stopLocator(
@CliOption(key = CliStrings.STOP_LOCATOR__MEMBER,
optionContext = ConverterHint.LOCATOR_MEMBER_IDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STOP_LOCATOR__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STOP_LOCATOR__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_LOCATOR__DIR__HELP) final String workingDirectory) {
LocatorState locatorState;
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean locatorProxy = getMemberMXBean(member);
@@ -887,13 +859,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
}
- return ResultBuilder.createInfoResult(StringUtils.EMPTY_STRING);
+ return ResultBuilder.createInfoResult(StringUtils.EMPTY);
} else {
return ResultBuilder.createUserErrorResult(locatorState.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -917,7 +887,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
if (StringUtils.isBlank(gemfireProperties.getProperty(LOCATORS))) {
String currentLocators = getCurrentLocators();
- if (!StringUtils.isBlank(currentLocators)) {
+ if (StringUtils.isNotBlank(currentLocators)) {
commandLine.add("-D".concat(ProcessLauncherContext.OVERRIDDEN_DEFAULTS_PREFIX)
.concat(LOCATORS).concat("=").concat(currentLocators));
}
@@ -934,14 +904,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected void addGemFirePropertyFile(final List<String> commandLine,
final String gemfirePropertiesPathname) {
- if (!StringUtils.isBlank(gemfirePropertiesPathname)) {
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)) {
commandLine.add("-DgemfirePropertyFile=" + gemfirePropertiesPathname);
}
}
protected void addGemFireSecurityPropertyFile(final List<String> commandLine,
final String gemfireSecurityPropertiesPathname) {
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)) {
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)) {
commandLine.add("-DgemfireSecurityPropertyFile=" + gemfireSecurityPropertiesPathname);
}
}
@@ -951,7 +921,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
for (final Object property : gemfireProperties.keySet()) {
final String propertyName = property.toString();
final String propertyValue = gemfireProperties.getProperty(propertyName);
- if (!StringUtils.isBlank(propertyValue)) {
+ if (StringUtils.isNotBlank(propertyValue)) {
commandLine.add(
"-D" + DistributionConfig.GEMFIRE_PREFIX + "" + propertyName + "=" + propertyValue);
}
@@ -959,7 +929,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected void addInitialHeap(final List<String> commandLine, final String initialHeap) {
- if (!StringUtils.isBlank(initialHeap)) {
+ if (StringUtils.isNotBlank(initialHeap)) {
commandLine.add("-Xms" + initialHeap);
}
}
@@ -997,7 +967,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected void addMaxHeap(final List<String> commandLine, final String maxHeap) {
- if (!StringUtils.isBlank(maxHeap)) {
+ if (StringUtils.isNotBlank(maxHeap)) {
commandLine.add("-Xmx" + maxHeap);
commandLine.add("-XX:+UseConcMarkSweepGC");
commandLine.add("-XX:CMSInitiatingOccupancyFraction=" + CMS_INITIAL_OCCUPANCY_FRACTION);
@@ -1053,8 +1023,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
fileReader = new BufferedReader(new FileReader(pidFile));
return Integer.parseInt(fileReader.readLine());
- } catch (IOException ignore) {
- } catch (NumberFormatException ignore) {
+ } catch (IOException | NumberFormatException ignore) {
} finally {
IOUtils.close(fileReader);
}
@@ -1094,7 +1063,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getClasspath(final String userClasspath) {
String classpath = getSystemClasspath();
- if (!StringUtils.isBlank(userClasspath)) {
+ if (StringUtils.isNotBlank(userClasspath)) {
classpath += (File.pathSeparator + userClasspath);
}
@@ -1124,9 +1093,9 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String toClasspath(final boolean includeSystemClasspath, String[] jarFilePathnames,
String... userClasspaths) {
// gemfire jar must absolutely be the first JAR file on the CLASSPATH!!!
- String classpath = getGemFireJarPath();
+ StringBuilder classpath = new StringBuilder(getGemFireJarPath());
- userClasspaths = (userClasspaths != null ? userClasspaths : StringUtils.EMPTY_STRING_ARRAY);
+ userClasspaths = (userClasspaths != null ? userClasspaths : ArrayUtils.EMPTY_STRING_ARRAY);
// Then, include user-specified classes on CLASSPATH to enable the user to override GemFire JAR
// dependencies
@@ -1137,30 +1106,30 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
// System CLASSPATH environment variable setting, which is consistent with the Java platform
// behavior...
for (String userClasspath : userClasspaths) {
- if (!StringUtils.isBlank(userClasspath)) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
- classpath += userClasspath;
+ if (StringUtils.isNotBlank(userClasspath)) {
+ classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : File.pathSeparator);
+ classpath.append(userClasspath);
}
}
// Now, include any System-specified CLASSPATH environment variable setting...
if (includeSystemClasspath) {
- classpath += File.pathSeparator;
- classpath += getSystemClasspath();
+ classpath.append(File.pathSeparator);
+ classpath.append(getSystemClasspath());
}
jarFilePathnames =
- (jarFilePathnames != null ? jarFilePathnames : StringUtils.EMPTY_STRING_ARRAY);
+ (jarFilePathnames != null ? jarFilePathnames : ArrayUtils.EMPTY_STRING_ARRAY);
// And finally, include all GemFire dependencies on the CLASSPATH...
for (String jarFilePathname : jarFilePathnames) {
- if (!StringUtils.isBlank(jarFilePathname)) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
- classpath += jarFilePathname;
+ if (StringUtils.isNotBlank(jarFilePathname)) {
+ classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : File.pathSeparator);
+ classpath.append(jarFilePathname);
}
}
- return classpath;
+ return classpath.toString();
}
protected String getGemFireJarPath() {
@@ -1194,7 +1163,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getLocatorId(final String host, final Integer port) {
final String locatorHost = (host != null ? host : getLocalHost());
final String locatorPort =
- StringUtils.valueOf(port, String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
+ StringUtils.defaultString(port, String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
return locatorHost.concat("[").concat(locatorPort).concat("]");
}
@@ -1238,7 +1207,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String objectNamePattern = ManagementConstants.OBJECTNAME__PREFIX;
- objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY_STRING
+ objectNamePattern += (StringUtils.isBlank(serviceName) ? StringUtils.EMPTY
: "service=" + serviceName + StringUtils.COMMA_DELIMITER);
objectNamePattern += "type=Member,*";
@@ -1266,7 +1235,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
protected String getServerId(final String host, final Integer port) {
String serverHost = (host != null ? host : getLocalHost());
- String serverPort = StringUtils.valueOf(port, String.valueOf(CacheServer.DEFAULT_PORT));
+ String serverPort = StringUtils.defaultString(port, String.valueOf(CacheServer.DEFAULT_PORT));
return serverHost.concat("[").concat(serverPort).concat("]");
}
@@ -1287,31 +1256,24 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true,
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startServer(
- @CliOption(key = CliStrings.START_SERVER__NAME, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.START_SERVER__NAME,
help = CliStrings.START_SERVER__NAME__HELP) String memberName,
@CliOption(key = CliStrings.START_SERVER__ASSIGN_BUCKETS, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__ASSIGN_BUCKETS__HELP) final Boolean assignBuckets,
@CliOption(key = CliStrings.START_SERVER__BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__BIND_ADDRESS__HELP) final String bindAddress,
@CliOption(key = CliStrings.START_SERVER__CACHE_XML_FILE,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CACHE_XML_FILE__HELP) String cacheXmlPathname,
@CliOption(key = CliStrings.START_SERVER__CLASSPATH,
/* optionContext = ConverterHint.FILE_PATH, // there's an issue with TAB here */
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CLASSPATH__HELP) final String classpath,
@CliOption(key = CliStrings.START_SERVER__CRITICAL__HEAP__PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CRITICAL__HEAP__HELP) final Float criticalHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__CRITICAL_OFF_HEAP_PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__CRITICAL_OFF_HEAP__HELP) final Float criticalOffHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__DIR__HELP) String workingDirectory,
@CliOption(key = CliStrings.START_SERVER__DISABLE_DEFAULT_SERVER,
unspecifiedDefaultValue = "false", specifiedDefaultValue = "true",
@@ -1320,98 +1282,70 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "false", specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__DISABLE_EXIT_WHEN_OUT_OF_MEMORY_HELP) final Boolean disableExitWhenOutOfMemory,
@CliOption(key = CliStrings.START_SERVER__ENABLE_TIME_STATISTICS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__ENABLE_TIME_STATISTICS__HELP) final Boolean enableTimeStatistics,
@CliOption(key = CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__EVICTION__HEAP__PERCENTAGE__HELP) final Float evictionHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__EVICTION_OFF_HEAP_PERCENTAGE__HELP) final Float evictionOffHeapPercentage,
@CliOption(key = CliStrings.START_SERVER__FORCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__FORCE__HELP) final Boolean force,
@CliOption(key = CliStrings.START_SERVER__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__GROUP__HELP) final String group,
@CliOption(key = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS__HELP) final String hostNameForClients,
@CliOption(key = CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH,
specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = CliStrings.START_SERVER__INCLUDE_SYSTEM_CLASSPATH__HELP) final Boolean includeSystemClasspath,
@CliOption(key = CliStrings.START_SERVER__INITIAL_HEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__INITIAL_HEAP__HELP) final String initialHeap,
@CliOption(key = CliStrings.START_SERVER__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__J__HELP) final String[] jvmArgsOpts,
@CliOption(key = CliStrings.START_SERVER__LOCATORS,
optionContext = ConverterHint.LOCATOR_DISCOVERY_CONFIG,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOCATORS__HELP) final String locators,
@CliOption(key = CliStrings.START_SERVER__LOCATOR_WAIT_TIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOCATOR_WAIT_TIME_HELP) final Integer locatorWaitTime,
- @CliOption(key = CliStrings.START_SERVER__LOCK_MEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "true",
+ @CliOption(key = CliStrings.START_SERVER__LOCK_MEMORY, specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__LOCK_MEMORY__HELP) final Boolean lockMemory,
@CliOption(key = CliStrings.START_SERVER__LOG_LEVEL, optionContext = ConverterHint.LOG_LEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__LOG_LEVEL__HELP) final String logLevel,
@CliOption(key = CliStrings.START_SERVER__MAX__CONNECTIONS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__CONNECTIONS__HELP) final Integer maxConnections,
@CliOption(key = CliStrings.START_SERVER__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAXHEAP__HELP) final String maxHeap,
@CliOption(key = CliStrings.START_SERVER__MAX__MESSAGE__COUNT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__MESSAGE__COUNT__HELP) final Integer maxMessageCount,
@CliOption(key = CliStrings.START_SERVER__MAX__THREADS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MAX__THREADS__HELP) final Integer maxThreads,
@CliOption(key = CliStrings.START_SERVER__MCAST_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MCAST_ADDRESS__HELP) final String mcastBindAddress,
@CliOption(key = CliStrings.START_SERVER__MCAST_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MCAST_PORT__HELP) final Integer mcastPort,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_PORT__HELP) final Integer memcachedPort,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_PROTOCOL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_PROTOCOL__HELP) final String memcachedProtocol,
@CliOption(key = CliStrings.START_SERVER__MEMCACHED_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MEMCACHED_BIND_ADDRESS__HELP) final String memcachedBindAddress,
@CliOption(key = CliStrings.START_SERVER__REDIS_PORT,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_PORT__HELP) final Integer redisPort,
@CliOption(key = CliStrings.START_SERVER__REDIS_BIND_ADDRESS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_BIND_ADDRESS__HELP) final String redisBindAddress,
@CliOption(key = CliStrings.START_SERVER__REDIS_PASSWORD,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__REDIS_PASSWORD__HELP) final String redisPassword,
@CliOption(key = CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__MESSAGE__TIME__TO__LIVE__HELP) final Integer messageTimeToLive,
@CliOption(key = CliStrings.START_SERVER__OFF_HEAP_MEMORY_SIZE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__OFF_HEAP_MEMORY_SIZE__HELP) final String offHeapMemorySize,
@CliOption(key = CliStrings.START_SERVER__PROPERTIES, optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__PROPERTIES__HELP) String gemfirePropertiesPathname,
@CliOption(key = CliStrings.START_SERVER__REBALANCE, unspecifiedDefaultValue = "false",
specifiedDefaultValue = "true",
help = CliStrings.START_SERVER__REBALANCE__HELP) final Boolean rebalance,
@CliOption(key = CliStrings.START_SERVER__SECURITY_PROPERTIES,
optionContext = ConverterHint.FILE_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SECURITY_PROPERTIES__HELP) String gemfireSecurityPropertiesPathname,
@CliOption(key = CliStrings.START_SERVER__SERVER_BIND_ADDRESS,
unspecifiedDefaultValue = CacheServer.DEFAULT_BIND_ADDRESS,
@@ -1420,13 +1354,10 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = ("" + CacheServer.DEFAULT_PORT),
help = CliStrings.START_SERVER__SERVER_PORT__HELP) final Integer serverPort,
@CliOption(key = CliStrings.START_SERVER__SOCKET__BUFFER__SIZE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SOCKET__BUFFER__SIZE__HELP) final Integer socketBufferSize,
@CliOption(key = CliStrings.START_SERVER__SPRING_XML_LOCATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__SPRING_XML_LOCATION_HELP) final String springXmlLocation,
@CliOption(key = CliStrings.START_SERVER__STATISTIC_ARCHIVE_FILE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_SERVER__STATISTIC_ARCHIVE_FILE__HELP) final String statisticsArchivePathname,
@CliOption(key = CliStrings.START_SERVER__USE_CLUSTER_CONFIGURATION,
unspecifiedDefaultValue = "true", specifiedDefaultValue = "true",
@@ -1452,7 +1383,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
// prompt for password is username is specified in the command
- if (!StringUtils.isBlank(userName)) {
+ if (StringUtils.isNotBlank(userName)) {
if (StringUtils.isBlank(passwordToUse)) {
passwordToUse = getGfsh().readPassword(START_SERVER__PASSWORD + ": ");
}
@@ -1466,24 +1397,25 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
- if (!StringUtils.isBlank(cacheXmlPathname) && !IOUtils.isExistingPathname(cacheXmlPathname)) {
+ if (StringUtils.isNotBlank(cacheXmlPathname)
+ && !IOUtils.isExistingPathname(cacheXmlPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
}
gemfirePropertiesPathname = CliUtil.resolvePathname(gemfirePropertiesPathname);
- if (!StringUtils.isBlank(gemfirePropertiesPathname)
+ if (StringUtils.isNotBlank(gemfirePropertiesPathname)
&& !IOUtils.isExistingPathname(gemfirePropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
- CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname));
+ CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+ gemfirePropertiesPathname));
}
gemfireSecurityPropertiesPathname =
CliUtil.resolvePathname(gemfireSecurityPropertiesPathname);
- if (!StringUtils.isBlank(gemfireSecurityPropertiesPathname)
+ if (StringUtils.isNotBlank(gemfireSecurityPropertiesPathname)
&& !IOUtils.isExistingPathname(gemfireSecurityPropertiesPathname)) {
return ResultBuilder.createUserErrorResult(
CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
@@ -1496,52 +1428,39 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
Properties gemfireProperties = new Properties();
- gemfireProperties.setProperty(BIND_ADDRESS,
- StringUtils.valueOf(bindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(CACHE_XML_FILE,
- StringUtils.valueOf(cacheXmlPathname, StringUtils.EMPTY_STRING));
+ gemfireProperties.setProperty(BIND_ADDRESS, StringUtils.defaultString(bindAddress));
+ gemfireProperties.setProperty(CACHE_XML_FILE, StringUtils.defaultString(cacheXmlPathname));
gemfireProperties.setProperty(ENABLE_TIME_STATISTICS,
- StringUtils.valueOf(enableTimeStatistics, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(GROUPS, StringUtils.valueOf(group, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATORS,
- StringUtils.valueOf(locators, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOCATOR_WAIT_TIME,
- StringUtils.valueOf(locatorWaitTime, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(LOG_LEVEL,
- StringUtils.valueOf(logLevel, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_ADDRESS,
- StringUtils.valueOf(mcastBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MCAST_PORT,
- StringUtils.valueOf(mcastPort, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(MEMCACHED_PORT,
- StringUtils.valueOf(memcachedPort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(enableTimeStatistics));
+ gemfireProperties.setProperty(GROUPS, StringUtils.defaultString(group));
+ gemfireProperties.setProperty(LOCATORS, StringUtils.defaultString(locators));
+ gemfireProperties.setProperty(LOCATOR_WAIT_TIME, StringUtils.defaultString(locatorWaitTime));
+ gemfireProperties.setProperty(LOG_LEVEL, StringUtils.defaultString(logLevel));
+ gemfireProperties.setProperty(MCAST_ADDRESS, StringUtils.defaultString(mcastBindAddress));
+ gemfireProperties.setProperty(MCAST_PORT, StringUtils.defaultString(mcastPort));
+ gemfireProperties.setProperty(MEMCACHED_PORT, StringUtils.defaultString(memcachedPort));
gemfireProperties.setProperty(MEMCACHED_PROTOCOL,
- StringUtils.valueOf(memcachedProtocol, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(memcachedProtocol));
gemfireProperties.setProperty(MEMCACHED_BIND_ADDRESS,
- StringUtils.valueOf(memcachedBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(REDIS_PORT,
- StringUtils.valueOf(redisPort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(memcachedBindAddress));
+ gemfireProperties.setProperty(REDIS_PORT, StringUtils.defaultString(redisPort));
gemfireProperties.setProperty(REDIS_BIND_ADDRESS,
- StringUtils.valueOf(redisBindAddress, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(REDIS_PASSWORD,
- StringUtils.valueOf(redisPassword, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(redisBindAddress));
+ gemfireProperties.setProperty(REDIS_PASSWORD, StringUtils.defaultString(redisPassword));
gemfireProperties.setProperty(STATISTIC_ARCHIVE_FILE,
- StringUtils.valueOf(statisticsArchivePathname, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(statisticsArchivePathname));
gemfireProperties.setProperty(USE_CLUSTER_CONFIGURATION,
- StringUtils.valueOf(requestSharedConfiguration, Boolean.TRUE.toString()));
- gemfireProperties.setProperty(LOCK_MEMORY,
- StringUtils.valueOf(lockMemory, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(requestSharedConfiguration, Boolean.TRUE.toString()));
+ gemfireProperties.setProperty(LOCK_MEMORY, StringUtils.defaultString(lockMemory));
gemfireProperties.setProperty(OFF_HEAP_MEMORY_SIZE,
- StringUtils.valueOf(offHeapMemorySize, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(START_DEV_REST_API,
- StringUtils.valueOf(startRestApi, StringUtils.EMPTY_STRING));
- gemfireProperties.setProperty(HTTP_SERVICE_PORT,
- StringUtils.valueOf(httpServicePort, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(offHeapMemorySize));
+ gemfireProperties.setProperty(START_DEV_REST_API, StringUtils.defaultString(startRestApi));
+ gemfireProperties.setProperty(HTTP_SERVICE_PORT, StringUtils.defaultString(httpServicePort));
gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS,
- StringUtils.valueOf(httpServiceBindAddress, StringUtils.EMPTY_STRING));
+ StringUtils.defaultString(httpServiceBindAddress));
// if username is specified in the command line, it will overwrite what's set in the
// properties file
- if (!StringUtils.isBlank(userName)) {
+ if (StringUtils.isNotBlank(userName)) {
gemfireProperties.setProperty(ResourceConstants.USER_NAME, userName);
gemfireProperties.setProperty(ResourceConstants.PASSWORD, passwordToUse);
}
@@ -1552,9 +1471,9 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
final boolean redirectOutput =
Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
- ServerLauncher serverLauncher = new ServerLauncher.Builder().setAssignBuckets(assignBuckets)
- .setDisableDefaultServer(disableDefaultServer).setForce(force).setMemberName(memberName)
- .setRebalance(rebalance).setRedirectOutput(redirectOutput)
+ ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder()
+ .setAssignBuckets(assignBuckets).setDisableDefaultServer(disableDefaultServer)
+ .setForce(force).setRebalance(rebalance).setRedirectOutput(redirectOutput)
.setServerBindAddress(serverBindAddress).setServerPort(serverPort)
.setSpringXmlLocation(springXmlLocation).setWorkingDirectory(workingDirectory)
.setCriticalHeapPercentage(criticalHeapPercentage)
@@ -1562,8 +1481,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
.setCriticalOffHeapPercentage(criticalOffHeapPercentage)
.setEvictionOffHeapPercentage(evictionOffHeapPercentage).setMaxConnections(maxConnections)
.setMaxMessageCount(maxMessageCount).setMaxThreads(maxThreads)
- .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize)
- .setHostNameForClients(hostNameForClients).build();
+ .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize);
+ if (hostNameForClients != null) {
+ serverLauncherBuilder.setHostNameForClients(hostNameForClients);
+ }
+ if (memberName != null) {
+ serverLauncherBuilder.setMemberName(memberName);
+ }
+ ServerLauncher serverLauncher = serverLauncherBuilder.build();
String[] serverCommandLine = createStartServerCommandLine(serverLauncher,
gemfirePropertiesPathname, gemfireSecurityPropertiesPathname, gemfireProperties,
@@ -1571,7 +1496,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
maxHeap);
if (getGfsh().getDebug()) {
- getGfsh().logInfo(StringUtils.concat(serverCommandLine, " "), null);
+ getGfsh().logInfo(StringUtils.join(serverCommandLine, StringUtils.SPACE), null);
}
Process serverProcess = new ProcessBuilder(serverCommandLine)
@@ -1722,7 +1647,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add(ServerLauncher.class.getName());
commandLine.add(ServerLauncher.Command.START.getName());
- if (!StringUtils.isBlank(launcher.getMemberName())) {
+ if (StringUtils.isNotBlank(launcher.getMemberName())) {
commandLine.add(launcher.getMemberName());
}
@@ -1847,16 +1772,13 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result statusServer(
@CliOption(key = CliStrings.STATUS_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STATUS_SERVER__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STATUS_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STATUS_SERVER__DIR__HELP) final String workingDirectory) {
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean serverProxy = getMemberMXBean(member);
@@ -1886,9 +1808,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
return ResultBuilder.createInfoResult(status.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -1905,18 +1825,15 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result stopServer(
@CliOption(key = CliStrings.STOP_SERVER__MEMBER, optionContext = ConverterHint.MEMBERIDNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__MEMBER__HELP) final String member,
@CliOption(key = CliStrings.STOP_SERVER__PID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__PID__HELP) final Integer pid,
@CliOption(key = CliStrings.STOP_SERVER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.STOP_SERVER__DIR__HELP) final String workingDirectory) {
ServerState serverState;
try {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
if (isConnectedAndReady()) {
final MemberMXBean serverProxy = getMemberMXBean(member);
@@ -1963,13 +1880,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
}
- return ResultBuilder.createInfoResult(StringUtils.EMPTY_STRING);
+ return ResultBuilder.createInfoResult(StringUtils.EMPTY);
} else {
return ResultBuilder.createUserErrorResult(serverState.toString());
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -1988,10 +1903,8 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
// CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_LIFECYCLE})
public Result startManager(
@CliOption(key = CliStrings.START_MANAGER__MEMBERNAME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__MEMBERNAME__HELP) String memberName,
@CliOption(key = CliStrings.START_MANAGER__DIR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__DIR__HELP) String dir,
@CliOption(key = CliStrings.START_MANAGER__PORT, unspecifiedDefaultValue = "1099",
help = CliStrings.START_MANAGER__PORT__HELP) int cacheServerPort,
@@ -1999,19 +1912,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "localhost",
help = CliStrings.START_MANAGER__BIND_ADDRESS__HELP) String cacheServerHost,
@CliOption(key = CliStrings.START_MANAGER__CLASSPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__CLASSPATH__HELP) String classpath,
@CliOption(key = CliStrings.START_MANAGER__MAXHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__MAXHEAP__HELP) String maxHeap,
@CliOption(key = CliStrings.START_MANAGER__INITIALHEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__INITIALHEAP__HELP) String initialHeap,
@CliOption(key = CliStrings.START_MANAGER__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__J__HELP) Map<String, String> systepProps,
@CliOption(key = CliStrings.START_MANAGER__GEODEPROPS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_MANAGER__GEODEPROPS__HELP) Map<String, String> gemfireProps) {
return ResultBuilder.createInfoResult("Not-implemented");
}
@@ -2026,13 +1934,11 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "false",
help = CliStrings.START_JCONSOLE__NOTILE__HELP) final boolean notile,
@CliOption(key = CliStrings.START_JCONSOLE__PLUGINPATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__PLUGINPATH__HELP) final String pluginpath,
@CliOption(key = CliStrings.START_JCONSOLE__VERSION, specifiedDefaultValue = "true",
unspecifiedDefaultValue = "false",
help = CliStrings.START_JCONSOLE__VERSION__HELP) final boolean version,
@CliOption(key = CliStrings.START_JCONSOLE__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__J__HELP) final List<String> jvmArgs) {
try {
String[] jconsoleCommandLine =
@@ -2064,18 +1970,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String jconsoleProcessOutput = waitAndCaptureProcessStandardErrorStream(jconsoleProcess);
- if (!StringUtils.isBlank(jconsoleProcessOutput)) {
+ if (StringUtils.isNotBlank(jconsoleProcessOutput)) {
message.append(StringUtils.LINE_SEPARATOR);
message.append(jconsoleProcessOutput);
}
}
return ResultBuilder.createInfoResult(message.toString());
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (IOException e) {
return ResultBuilder
@@ -2106,7 +2008,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
commandLine.add("-notile");
}
- if (!StringUtils.isBlank(pluginpath)) {
+ if (StringUtils.isNotBlank(pluginpath)) {
commandLine.add("-pluginpath " + pluginpath);
}
@@ -2118,7 +2020,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String jmxServiceUrl = getJmxServiceUrlAsString(member);
- if (!StringUtils.isBlank(jmxServiceUrl)) {
+ if (StringUtils.isNotBlank(jmxServiceUrl)) {
commandLine.add(jmxServiceUrl);
}
}
@@ -2166,20 +2068,18 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
}
protected static String getExecutableSuffix() {
- return SystemUtils.isWindows() ? ".exe" : StringUtils.EMPTY_STRING;
+ return SystemUtils.isWindows() ? ".exe" : StringUtils.EMPTY;
}
protected String getJmxServiceUrlAsString(final String member) {
- if (!StringUtils.isBlank(member)) {
+ if (StringUtils.isNotBlank(member)) {
ConnectionEndpointConverter converter = new ConnectionEndpointConverter();
try {
ConnectionEndpoint connectionEndpoint =
converter.convertFromText(member, ConnectionEndpoint.class, null);
-
- return StringUtils.concat("service:jmx:rmi://", connectionEndpoint.getHost(), ":",
- connectionEndpoint.getPort(), "/jndi/rmi://", connectionEndpoint.getHost(), ":",
- connectionEndpoint.getPort(), "/jmxrmi");
+ String hostAndPort = connectionEndpoint.getHost() + ":" + connectionEndpoint.getPort();
+ return String.format("service:jmx:rmi://%s/jndi/rmi://%s/jmxrmi", hostAndPort, hostAndPort);
} catch (Exception e) {
throw new IllegalArgumentException(
CliStrings.START_JCONSOLE__CONNECT_BY_MEMBER_NAME_ID_ERROR_MESSAGE);
@@ -2201,7 +2101,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
@CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER,
CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M})
public Result startJVisualVM(@CliOption(key = CliStrings.START_JCONSOLE__J,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.START_JCONSOLE__J__HELP) final List<String> jvmArgs) {
try {
String[] jvisualvmCommandLine = createJVisualVMCommandLine(jvmArgs);
@@ -2219,17 +2118,13 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(jvisualvmProcessOutput)) {
+ if (StringUtils.isNotBlank(jvisualvmProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(jvisualvmProcessOutput);
}
return ResultBuilder.buildResult(infoResultData);
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -2285,7 +2180,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
unspecifiedDefaultValue = "http://localhost:7070/pulse",
help = CliStrings.START_PULSE__URL__HELP) final String url) {
try {
- if (!StringUtils.isBlank(url)) {
+ if (StringUtils.isNotBlank(url)) {
browse(URI.create(url));
return ResultBuilder.createInfoResult(CliStrings.START_PULSE__RUN);
} else {
@@ -2298,14 +2193,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
String pulseURL =
(String) operationInvoker.getAttribute(managerObjectName.toString(), "PulseURL");
- if (!StringUtils.isBlank(pulseURL)) {
+ if (StringUtils.isNotBlank(pulseURL)) {
browse(URI.create(pulseURL));
return ResultBuilder
.createInfoResult(CliStrings.START_PULSE__RUN + " with URL: " + pulseURL);
} else {
String pulseMessage = (String) operationInvoker
.getAttribute(managerObjectName.toString(), "StatusMessage");
- return (!StringUtils.isBlank(pulseMessage)
+ return (StringUtils.isNotBlank(pulseMessage)
? ResultBuilder.createGemFireErrorResult(pulseMessage)
: ResultBuilder.createGemFireErrorResult(CliStrings.START_PULSE__URL__NOTFOUND));
}
@@ -2314,8 +2209,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
.format(CliStrings.GFSH_MUST_BE_CONNECTED_FOR_LAUNCHING_0, "GemFire Pulse"));
}
}
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (Exception e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
@@ -2373,7 +2266,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String geodeHome = System.getenv("GEODE_HOME");
- assertState(!StringUtils.isBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
+ assertState(StringUtils.isNotBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
assertState(IOUtils.isExistingPathname(getPathToVsd()),
String.format(CliStrings.START_VSD__NOT_FOUND_ERROR_MESSAGE, geodeHome));
@@ -2393,19 +2286,14 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(vsdProcessOutput)) {
+ if (StringUtils.isNotBlank(vsdProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(vsdProcessOutput);
}
return ResultBuilder.buildResult(infoResultData);
- } catch (GemFireException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (FileNotFoundException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createShellClientErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (GemFireException | IllegalStateException | IllegalArgumentException
+ | FileNotFoundException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -2489,7 +2377,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
try {
String geodeHome = System.getenv("GEODE_HOME");
- assertState(!StringUtils.isBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
+ assertState(StringUtils.isNotBlank(geodeHome), CliStrings.GEODE_HOME_NOT_FOUND_ERROR_MESSAGE);
if (isConnectedAndReady()
&& (getGfsh().getOperationInvoker() instanceof JmxOperationInvoker)) {
@@ -2518,7 +2406,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
InfoResultData infoResultData = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(dataBrowserProcessOutput)) {
+ if (StringUtils.isNotBlank(dataBrowserProcessOutput)) {
infoResultData.addLine(StringUtils.LINE_SEPARATOR);
infoResultData.addLine(dataBrowserProcessOutput);
}
@@ -2528,9 +2416,7 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
return ResultBuilder.createUserErrorResult(CliStrings.format(
CliStrings.GFSH_MUST_BE_CONNECTED_VIA_JMX_FOR_LAUNCHING_0, "GemFire DataBrowser"));
}
- } catch (IllegalArgumentException e) {
- return ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
return ResultBuilder.createUserErrorResult(e.getMessage());
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
index c9e79b0..ad344ff 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShellCommands.java
@@ -20,11 +20,11 @@ import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_P
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.DSFIDFactory;
import org.apache.geode.internal.lang.Initializer;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.internal.util.PasswordUtil;
@@ -181,7 +181,7 @@ public class ShellCommands implements CommandMarker {
if (locatorResponseException != null) {
String locatorResponseExceptionMessage = locatorResponseException.getMessage();
- locatorResponseExceptionMessage = (!StringUtils.isBlank(locatorResponseExceptionMessage)
+ locatorResponseExceptionMessage = (StringUtils.isNotBlank(locatorResponseExceptionMessage)
? locatorResponseExceptionMessage : locatorResponseException.toString());
exceptionMessage = "Exception caused JMX Manager startup to fail because: '"
.concat(locatorResponseExceptionMessage).concat("'");
@@ -560,7 +560,7 @@ public class ShellCommands implements CommandMarker {
try {
KeyManagerFactory keyManagerFactory = null;
- if (!StringUtils.isBlank(keystoreToUse)) {
+ if (StringUtils.isNotBlank(keystoreToUse)) {
KeyStore clientKeys = KeyStore.getInstance("JKS");
keyStoreStream = new FileInputStream(keystoreToUse);
clientKeys.load(keyStoreStream, keystorePasswordToUse.toCharArray());
@@ -572,7 +572,7 @@ public class ShellCommands implements CommandMarker {
// load server public key
TrustManagerFactory trustManagerFactory = null;
- if (!StringUtils.isBlank(truststoreToUse)) {
+ if (StringUtils.isNotBlank(truststoreToUse)) {
KeyStore serverPub = KeyStore.getInstance("JKS");
trustStoreStream = new FileInputStream(truststoreToUse);
serverPub.load(trustStoreStream, truststorePasswordToUse.toCharArray());
@@ -622,7 +622,7 @@ public class ShellCommands implements CommandMarker {
URL gfSecurityPropertiesUrl = null;
// Case 1: User has specified gfSecurity properties file
- if (!StringUtils.isBlank(gfSecurityPropertiesPathToUse)) {
+ if (StringUtils.isNotBlank(gfSecurityPropertiesPathToUse)) {
// User specified gfSecurity properties doesn't exist
if (!IOUtils.isExistingPathname(gfSecurityPropertiesPathToUse)) {
gfshInstance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
index 3fadd96..d1e3f9e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/FilePathStringConverter.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.converters;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.cli.ConverterHint;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
index 59851da..20b37b3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/converters/GatewaySenderIdConverter.java
@@ -14,20 +14,19 @@
*/
package org.apache.geode.management.internal.cli.converters;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
import org.apache.geode.management.cli.ConverterHint;
import org.apache.geode.management.internal.ManagementConstants;
import org.apache.geode.management.internal.cli.shell.Gfsh;
-
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
import org.springframework.shell.core.MethodTarget;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
/**
*
* @since GemFire 7.0
@@ -64,7 +63,7 @@ public class GatewaySenderIdConverter implements Converter<String> {
Gfsh gfsh = Gfsh.getCurrentInstance();
if (gfsh != null && gfsh.isConnectedAndReady()) {
final String[] gatewaySenderIdArray = (String[]) gfsh.getOperationInvoker().invoke(
- ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN, "listGatwaySenders",
+ ManagementConstants.OBJECTNAME__DISTRIBUTEDSYSTEM_MXBEAN, "listGatewaySenders",
new Object[0], new String[0]);
if (gatewaySenderIdArray != null && gatewaySenderIdArray.length != 0) {
gatewaySenderIds = new TreeSet<String>(Arrays.asList(gatewaySenderIdArray));
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
index b5d1b0c..d1a1107 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/DiskStoreDetails.java
@@ -15,6 +15,11 @@
package org.apache.geode.management.internal.cli.domain;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.DiskStoreFactory;
+import org.apache.geode.internal.lang.MutableIdentifiable;
+import org.apache.geode.internal.lang.ObjectUtils;
+
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
@@ -23,11 +28,6 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
-import org.apache.geode.cache.DiskStoreFactory;
-import org.apache.geode.internal.lang.MutableIdentifiable;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The DiskStoreDetails class captures information about a particular disk store for a GemFire
* distributed system member. Each disk store for a member should be captured in separate instance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
index 64bb512..335302e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/domain/IndexDetails.java
@@ -15,13 +15,13 @@
package org.apache.geode.management.internal.cli.domain;
-import java.io.Serializable;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.query.Index;
import org.apache.geode.cache.query.IndexStatistics;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
+
+import java.io.Serializable;
/**
* The IndexDetails class encapsulates information for an Index on a Region in the GemFire Cache.
@@ -91,11 +91,11 @@ public class IndexDetails implements Comparable<IndexDetails>, Serializable {
}
public IndexDetails(final String memberId, final String regionPath, final String indexName) {
- assertValidArgument(!StringUtils.isBlank(memberId),
+ assertValidArgument(StringUtils.isNotBlank(memberId),
"The member having a region with an index must be specified!");
- assertValidArgument(!StringUtils.isBlank(regionPath),
+ assertValidArgument(StringUtils.isNotBlank(regionPath),
"The region in member (%1$s) with an index must be specified!", memberId);
- assertValidArgument(!StringUtils.isBlank(indexName),
+ assertValidArgument(StringUtils.isNotBlank(indexName),
"The name of the index on region (%1$s) of member (%2$s) must be specified!", regionPath,
memberId);
this.memberId = memberId;
@@ -307,7 +307,7 @@ public class IndexDetails implements Comparable<IndexDetails>, Serializable {
}
IndexType(final String description) {
- assertValidArgument(!StringUtils.isBlank(description),
+ assertValidArgument(StringUtils.isNotBlank(description),
"The description for the IndexType must be specified!");
this.description = description;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
index 4c241d0..68cc2e0 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
@@ -15,11 +15,7 @@
package org.apache.geode.management.internal.cli.functions;
-import java.io.File;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -35,14 +31,17 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-
import org.apache.logging.log4j.Logger;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
/**
* The DescribeDiskStoreFunction class is an implementation of a GemFire Function used to collect
* information and details about a particular disk store for a particular GemFire distributed system
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
index 57d209b..c688d7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/FetchSharedConfigurationStatusFunction.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.distributed.DistributedMember;
@@ -21,7 +22,6 @@ import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus;
public class FetchSharedConfigurationStatusFunction extends FunctionAdapter
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
index c99f84a..0811931 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
@@ -14,12 +14,7 @@
*/
package org.apache.geode.management.internal.cli.functions;
-import java.util.Set;
-
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.CacheListener;
@@ -38,6 +33,7 @@ import org.apache.geode.cache.execute.FunctionAdapter;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.ResultSender;
import org.apache.geode.compression.Compressor;
+import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.xmlcache.CacheXml;
import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -48,6 +44,9 @@ import org.apache.geode.management.internal.cli.exceptions.CreateSubregionExcept
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.RegionPath;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Set;
/**
*
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
index 4383044..78879d3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/HelpBlock.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.help;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.internal.cli.GfshParser;
import org.apache.geode.management.internal.cli.shell.Gfsh;
@@ -33,7 +33,7 @@ public class HelpBlock {
public HelpBlock() {}
public HelpBlock(String data) {
- if (!StringUtils.isBlank(data)) {
+ if (StringUtils.isNotBlank(data)) {
this.data = data;
this.level = 0;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
index 9dbf59c..3525013 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java
@@ -231,7 +231,7 @@ public class Helper {
}
// Now comes the turn to display synopsis if any
- if (!StringUtils.isBlank(cliCommand.help())) {
+ if (StringUtils.isNotBlank(cliCommand.help())) {
HelpBlock synopsis = new HelpBlock(SYNOPSIS_NAME);
synopsis.addChild(new HelpBlock(cliCommand.help()));
root.addChild(synopsis);
@@ -259,7 +259,7 @@ public class Helper {
HelpBlock getOptionDetail(CliOption cliOption) {
HelpBlock optionNode = new HelpBlock(getPrimaryKey(cliOption));
String help = cliOption.help();
- optionNode.addChild(new HelpBlock((!StringUtils.isBlank(help) ? help : "")));
+ optionNode.addChild(new HelpBlock((StringUtils.isNotBlank(help) ? help : "")));
if (getSynonyms(cliOption).size() > 0) {
StringBuilder builder = new StringBuilder();
for (String string : getSynonyms(cliOption)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
index 9bd2bf9..6332540 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/ResultBuilder.java
@@ -14,15 +14,13 @@
*/
package org.apache.geode.management.internal.cli.result;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
+import java.util.Collection;
+import java.util.List;
+
/**
*
*
@@ -170,7 +168,7 @@ public class ResultBuilder {
}
public static <T extends CliJsonSerializable> ObjectResultData<T> createObjectResultData() {
- return new ObjectResultData<T>();
+ return new ObjectResultData<>();
}
// public static CatalogedResultData createCatalogedResultData() {
@@ -228,13 +226,13 @@ public class ResultBuilder {
* Bad Response.
*/
public static Result fromJson(String json) {
- Result result = null;
+ Result result;
try {
GfJsonObject jsonObject = new GfJsonObject(json);
String contentType = jsonObject.getString("contentType");
GfJsonObject data = jsonObject.getJSONObject("data");
- AbstractResultData resultData = null;
+ AbstractResultData resultData;
if (ResultData.TYPE_TABULAR.equals(contentType)) {
resultData = new TabularResultData(data);
} /*
@@ -247,7 +245,7 @@ public class ResultBuilder {
} else if (ResultData.TYPE_COMPOSITE.equals(contentType)) {
resultData = new CompositeResultData(data);
} else if (ResultData.TYPE_OBJECT.equals(contentType)) {
- resultData = new ObjectResultData<CliJsonSerializable>(data);
+ resultData = new ObjectResultData<>(data);
} else {
ErrorResultData errorResultData = new ErrorResultData();
errorResultData.addLine("Can not detect result type, unknown response format: " + json);
@@ -284,7 +282,7 @@ public class ResultBuilder {
* @return Read only ResultData of the same type
*/
static ResultData getReadOnlyResultData(ResultData resultData) {
- ResultData wrapperResultData = null;
+ ResultData wrapperResultData;
String contentType = resultData.getType();
if (ResultData.TYPE_TABULAR.equals(contentType)) {
wrapperResultData = new TabularResultData(resultData.getGfJsonObject()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
index da3c4ae..ff23512 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/TableBuilder.java
@@ -53,12 +53,12 @@ package org.apache.geode.management.internal.cli.result;
*
* @since GemFire 7.0
*/
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.internal.cli.GfshParser;
+
import java.util.ArrayList;
import java.util.List;
-import org.apache.geode.management.internal.cli.GfshParser;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-
public class TableBuilder {
public static Table newTable() {
@@ -66,7 +66,7 @@ public class TableBuilder {
}
public static class Table {
- private final List<RowGroup> rowGroups = new ArrayList<RowGroup>();
+ private final List<RowGroup> rowGroups = new ArrayList<>();
private String columnSeparator = " ";
private boolean isTabularResult = false;
@@ -138,7 +138,7 @@ public class TableBuilder {
}
public String buildTable() {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
for (RowGroup rowGroup : this.rowGroups) {
stringBuffer.append(rowGroup.buildRowGroup(isTabularResult));
}
@@ -147,7 +147,7 @@ public class TableBuilder {
}
public List<String> buildTableList() {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (RowGroup rowGroup : this.rowGroups) {
list.add(rowGroup.buildRowGroup(isTabularResult));
}
@@ -169,7 +169,7 @@ public class TableBuilder {
*/
public static class RowGroup {
private final Table table;
- private final List<Row> rows = new ArrayList<Row>();
+ private final List<Row> rows = new ArrayList<>();
private int[] colSizes;
private String columnSeparator;
@@ -202,11 +202,11 @@ public class TableBuilder {
public String buildRowGroup(boolean isTabularResult) {
this.colSizes = computeColSizes(isTabularResult);
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
for (Row row : rows) {
String builtRow = row.buildRow(isTabularResult);
stringBuffer.append(builtRow);
- if (!builtRow.trim().isEmpty() || row.isBlank) {
+ if (StringUtils.isNotBlank(builtRow) || row.isBlank) {
stringBuffer.append(GfshParser.LINE_SEPARATOR);
}
}
@@ -275,7 +275,7 @@ public class TableBuilder {
public static class Row {
private final RowGroup rowGroup;
private final Character rowSeparator;
- private final List<Column> columns = new ArrayList<Column>();
+ private final List<Column> columns = new ArrayList<>();
boolean isBlank;
private boolean isTablewideSeparator;
@@ -335,7 +335,7 @@ public class TableBuilder {
}
private String buildRow(boolean isTabularResult) {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
if (this.rowSeparator != null) {
if (isTablewideSeparator) {
int maxColLength = this.rowGroup.getTable().getMaxLength();
@@ -383,8 +383,8 @@ public class TableBuilder {
}
private static enum Align {
- LEFT, RIGHT, CENTER;
- };
+ LEFT, RIGHT, CENTER
+ }
private static class Column {
@@ -411,7 +411,7 @@ public class TableBuilder {
// This can happen because colSizes are re-computed
// to fit the screen width
if (this.stringValue.length() > colWidth) {
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
int endIndex = colWidth - 2;
if (endIndex < 0)
return "";
@@ -422,7 +422,7 @@ public class TableBuilder {
if (trimIt)
numSpaces = 0;
- StringBuffer stringBuffer = new StringBuffer();
+ StringBuilder stringBuffer = new StringBuilder();
switch (align) {
case LEFT:
[28/28] geode git commit: Add ServerLauncherUtils and CacheServerUtils
Posted by kl...@apache.org.
Add ServerLauncherUtils and CacheServerUtils
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/060faa5e
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/060faa5e
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/060faa5e
Branch: refs/heads/feature/GEODE-2632-16
Commit: 060faa5e3a0de264c26727e34d70a8084b7fcaa5
Parents: db81427
Author: Kirk Lund <kl...@apache.org>
Authored: Fri May 19 14:57:44 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:58:25 2017 -0700
----------------------------------------------------------------------
.../geode/distributed/ServerLauncherUtils.java | 30 +++++++++++
.../cache/tier/sockets/CacheServerUtils.java | 55 ++++++++++++++++++++
2 files changed, 85 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/060faa5e/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherUtils.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherUtils.java
new file mode 100644
index 0000000..017e0f5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherUtils.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed;
+
+import org.apache.geode.cache.Cache;
+
+/**
+ * Provides tests a way to access non-public state in ServerLauncher
+ */
+public class ServerLauncherUtils {
+
+ /**
+ * Returns the Cache from an online in-process ServerLauncher instance
+ */
+ public static Cache getCache(final ServerLauncher serverLauncher) {
+ return serverLauncher.getCache();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/060faa5e/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CacheServerUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CacheServerUtils.java b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CacheServerUtils.java
new file mode 100644
index 0000000..8cd7622
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/CacheServerUtils.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.internal.cache.CacheServerImpl;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Provides tests a way to access CacheServer, AcceptorImpl and ServerConnection
+ */
+public class CacheServerUtils {
+
+ /**
+ * Returns single CacheServer for the specified Cache instance
+ */
+ public static CacheServer getCacheServer(final Cache cache) {
+ List<CacheServer> cacheServers = cache.getCacheServers();
+ CacheServer cacheServer = cacheServers.get(0);
+ return cacheServer;
+ }
+
+ /**
+ * Returns AcceptorImpl for the specified CacheServer instance
+ */
+ public static AcceptorImpl getAcceptorImpl(final CacheServer cacheServer) {
+ AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor();
+ return acceptor;
+ }
+
+ /**
+ * Returns single ServerConnection for the specified CacheServer instance
+ */
+ public static ServerConnection getServerConnection(final CacheServer cacheServer) {
+ AcceptorImpl acceptor = ((CacheServerImpl) cacheServer).getAcceptor();
+ Set<ServerConnection> serverConnections = acceptor.getAllServerConnections();
+ ServerConnection serverConnection = serverConnections.iterator().next(); // null
+ return serverConnection;
+ }
+}
[08/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
GEODE-1994: Overhaul of internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
* geode.internal.lang.StringUtils has been deprecated. In the interim, it has been heavily refactored and extends commons.lang.StringUtils.
*
* Renamed:
* -- EMPTY_STRING -> EMPTY (inherited)
* -- toUpperCase -> upperCase (inherited)
* -- toLowerCase -> lowerCase (inherited)
* -- padEnding -> rightPad (inherited)
*
* Removed:
* -- EMPTY_STRING_ARRAY; usage replaced with commons.lang.ArrayUtils.EMPTY_STRING_ARRAY
* -- SPACES
* -- UTF_8; rare usage replaced with raw string
* -- concat; usage replaced with commons.lang.join, refactoring as necessary.
* -- getLettersOnly
* -- getSpaces
* -- truncate
* -- valueOf; usage refactored to use defaultString
*
* Refactored
* -- defaultIfBlank: previously relied on varargs and could return null. Usage refactored to allow inheritance from commons.
* -- defaultString(s, EMPTY) refactored to use standard signature defaultString(s) for consistency throughout codebase.
* -- isBlank: usage refactored to resolve discrepancies with commons.lang.isBlank, which is now inherited.
* -- isEmpty: usage refactored to resolve discrepancies with commons.lang.isEmpty, which is now inherited.
*
* Code Cleanup:
* -- Many uses of !isBlank -> isNotBlank
* -- Changes suggested by Inspections on most touched files.
* -- Explicit <T> -> <> when type is inferable
* -- while loops operating on iterators converted to for each loops
* -- for loops operating on array indices converted to for each loops
* -- Various string typos corrected.
* -- isEmpty(s.trim()) -> isBlank(s)
* -- s.trim().isEmpty() -> isEmpty(s)
* -- Removed some instances of 'dead' code
* -- Optimized imports in every touched file
*
* Qualitative Changes:
* -- The following functions now throw an error when called with a null string input:
* -- * LocatorLauncher.Builder.setMemberName
* -- * ServerLauncher.Builder.setMemberName
* -- * ServerLauncher.Builder.setHostnameForClients
* -- (Unit tests added to capture these changes)
*
* Notes:
* -- StringUtils.wraps may be inherited from Apache Commons when the dependency is updated.
* -- AbstractLauncher.getMember has the documented behavior of returning null when both MemberName and ID are blank. Is this the best behavior for this method?
* this closes #521
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d16d192b
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d16d192b
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d16d192b
Branch: refs/heads/feature/GEODE-2632-16
Commit: d16d192b22f2932ac95780f18e92f0aece730240
Parents: 9af854a
Author: Patrick Rhomberg <pr...@pivotal.io>
Authored: Wed May 17 16:57:07 2017 -0700
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri May 19 10:29:16 2017 -0700
----------------------------------------------------------------------
.../LauncherLifecycleCommandsDUnitTest.java | 77 ++--
.../commands/LauncherLifecycleCommandsTest.java | 61 +--
.../web/controllers/RestAPITestBase.java | 54 +--
.../internal/locator/LocatorStatusResponse.java | 32 +-
.../query/internal/AttributeDescriptor.java | 70 +---
.../cache/query/internal/NWayMergeResults.java | 31 +-
.../geode/distributed/AbstractLauncher.java | 27 +-
.../geode/distributed/LocatorLauncher.java | 58 ++-
.../geode/distributed/ServerLauncher.java | 72 ++--
.../internal/ClusterConfigurationService.java | 64 ++--
.../distributed/internal/InternalLocator.java | 46 +--
.../membership/gms/membership/GMSJoinLeave.java | 67 ++--
.../geode/internal/InternalDataSerializer.java | 134 +++----
.../admin/remote/RemoteTransportConfig.java | 25 +-
.../cache/ClusterConfigurationLoader.java | 47 ++-
.../geode/internal/cache/EntryEventImpl.java | 20 +-
.../internal/cache/tier/sockets/HandShake.java | 85 ++---
.../apache/geode/internal/lang/StringUtils.java | 268 ++-----------
.../apache/geode/internal/lang/SystemUtils.java | 4 +-
.../internal/process/FileProcessController.java | 11 +-
.../geode/internal/process/signal/Signal.java | 4 +-
.../security/IntegratedSecurityService.java | 10 +-
.../apache/geode/internal/util/ArrayUtils.java | 11 +-
.../org/apache/geode/internal/util/IOUtils.java | 6 +-
.../geode/management/internal/AgentUtil.java | 8 +-
.../geode/management/internal/JettyHelper.java | 27 +-
.../management/internal/ManagementAgent.java | 60 ++-
.../geode/management/internal/RestAgent.java | 21 +-
.../geode/management/internal/SSLUtil.java | 5 +-
.../internal/beans/DistributedSystemBridge.java | 175 ++++-----
.../internal/beans/DistributedSystemMBean.java | 11 +-
.../internal/beans/ManagementAdapter.java | 82 ++--
.../internal/beans/QueryDataFunction.java | 90 ++---
.../geode/management/internal/cli/CliUtil.java | 48 +--
.../cli/commands/AbstractCommandsSupport.java | 15 +-
.../internal/cli/commands/ConfigCommands.java | 40 +-
.../CreateAlterDestroyRegionCommands.java | 187 ++++------
...xportImportClusterConfigurationCommands.java | 34 +-
.../internal/cli/commands/IndexCommands.java | 25 +-
.../cli/commands/LauncherLifecycleCommands.java | 372 +++++++------------
.../internal/cli/commands/ShellCommands.java | 10 +-
.../cli/converters/FilePathStringConverter.java | 2 +-
.../converters/GatewaySenderIdConverter.java | 15 +-
.../internal/cli/domain/DiskStoreDetails.java | 10 +-
.../internal/cli/domain/IndexDetails.java | 14 +-
.../functions/DescribeDiskStoreFunction.java | 13 +-
.../FetchSharedConfigurationStatusFunction.java | 2 +-
.../cli/functions/RegionCreateFunction.java | 11 +-
.../management/internal/cli/help/HelpBlock.java | 4 +-
.../management/internal/cli/help/Helper.java | 4 +-
.../internal/cli/result/ResultBuilder.java | 18 +-
.../internal/cli/result/TableBuilder.java | 30 +-
.../internal/cli/shell/GfshConfig.java | 6 +-
.../cli/shell/GfshExecutionStrategy.java | 16 +-
.../internal/cli/shell/JmxOperationInvoker.java | 4 +-
.../internal/cli/util/CommandStringBuilder.java | 4 +-
.../configuration/domain/XmlEntity.java | 50 ++-
.../messages/ConfigurationRequest.java | 12 +-
.../messages/ConfigurationResponse.java | 22 +-
.../internal/configuration/utils/XmlUtils.java | 33 +-
.../controllers/AbstractCommandsController.java | 62 ++--
.../controllers/ConfigCommandsController.java | 10 +-
.../web/controllers/DataCommandsController.java | 4 +-
.../controllers/DeployCommandsController.java | 13 +-
.../DiskStoreCommandsController.java | 16 +-
.../DurableClientCommandsController.java | 14 +-
.../web/controllers/ExportLogController.java | 2 +-
.../controllers/FunctionCommandsController.java | 10 +-
.../MiscellaneousCommandsController.java | 4 +-
.../web/controllers/PdxCommandsController.java | 9 +-
.../controllers/QueueCommandsController.java | 7 +-
.../controllers/RegionCommandsController.java | 11 +-
.../controllers/ShellCommandsController.java | 34 +-
.../web/controllers/WanCommandsController.java | 55 ++-
.../management/internal/web/domain/Link.java | 12 +-
.../internal/web/domain/LinkIndex.java | 6 +-
.../internal/web/http/HttpHeader.java | 4 +-
.../web/shell/RestHttpOperationInvoker.java | 4 +-
.../internal/web/util/ConvertUtils.java | 11 +-
.../management/internal/web/util/UriUtils.java | 4 +-
.../cache/client/internal/LocatorTestBase.java | 40 +-
.../AbstractLauncherIntegrationTestCase.java | 2 +-
.../geode/distributed/AbstractLauncherTest.java | 24 +-
.../LocatorLauncherIntegrationTest.java | 14 +-
.../geode/distributed/LocatorLauncherTest.java | 61 ++-
.../ServerLauncherIntegrationTest.java | 14 +-
.../geode/distributed/ServerLauncherTest.java | 40 +-
.../internal/lang/ClassUtilsJUnitTest.java | 15 +-
.../internal/lang/StringUtilsJUnitTest.java | 244 +-----------
.../internal/util/CollectionUtilsJUnitTest.java | 96 ++---
.../AbstractCommandsSupportJUnitTest.java | 40 +-
.../cli/commands/ListIndexCommandDUnitTest.java | 45 ++-
.../internal/configuration/ClusterConfig.java | 14 +-
.../dunit/rules/GfshShellConnectionRule.java | 2 +-
.../internal/cli/LuceneIndexCommands.java | 45 +--
.../functions/LuceneCreateIndexFunction.java | 3 +-
.../cli/LuceneIndexCommandsJUnitTest.java | 61 +--
.../pulse/testbed/PropMockDataUpdater.java | 17 +-
.../geodefunctions/RetrieveRegionFunction.java | 20 +-
.../internal/web/AbstractWebTestCase.java | 14 +-
.../ShellCommandsControllerJUnitTest.java | 38 +-
.../RestHttpOperationInvokerJUnitTest.java | 40 +-
102 files changed, 1648 insertions(+), 2297 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
index 5277e57..27bc098 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsDUnitTest.java
@@ -14,41 +14,13 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.Wait.*;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.nio.charset.Charset;
-import java.text.DateFormat;
-import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedDeque;
-import java.util.concurrent.TimeUnit;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runners.MethodSorters;
+import static org.apache.geode.distributed.ConfigurationProperties.DURABLE_CLIENT_ID;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertFalse;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.Wait.waitForCriterion;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
@@ -79,6 +51,37 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.test.dunit.WaitCriterion;
import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runners.MethodSorters;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.TimeUnit;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
/**
* The LauncherLifecycleCommandsDUnitTest class is a test suite of integration tests testing the
@@ -389,7 +392,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultString,
resultString
.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesPathname)));
+ StringUtils.EMPTY, gemfirePropertiesPathname)));
}
/**
@@ -525,7 +528,7 @@ public class LauncherLifecycleCommandsDUnitTest extends CliCommandTestBase {
assertTrue(resultString,
resultString
.contains(MessageFormat.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE,
- StringUtils.EMPTY_STRING, gemfirePropertiesFile)));
+ StringUtils.EMPTY, gemfirePropertiesFile)));
}
@Test
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
index 0554f69..2a1662e 100755
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommandsTest.java
@@ -14,33 +14,42 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-
-import org.apache.geode.distributed.LocatorLauncher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.GemFireException;
import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.LocatorLauncher;
import org.apache.geode.distributed.ServerLauncher;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.DistributionLocator;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Stack;
/**
* The LauncherLifecycleCommandsTest class is a test suite of test cases testing the contract and
@@ -77,7 +86,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addGemFirePropertyFile(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addGemFirePropertyFile(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -106,7 +115,7 @@ public class LauncherLifecycleCommandsTest {
gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
gemfireProperties.setProperty(LOG_LEVEL, "config");
- gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY_STRING);
+ gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
gemfireProperties.setProperty(MCAST_PORT, "0");
gemfireProperties.setProperty(NAME, "machine");
@@ -144,7 +153,7 @@ public class LauncherLifecycleCommandsTest {
gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
gemfireProperties.setProperty(LOG_LEVEL, "config");
- gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY_STRING);
+ gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
gemfireProperties.setProperty(MCAST_PORT, "0");
gemfireProperties.setProperty(NAME, "machine");
@@ -182,7 +191,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addInitialHeap(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addInitialHeap(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -255,7 +264,7 @@ public class LauncherLifecycleCommandsTest {
assertTrue(commandLine.isEmpty());
- getLauncherLifecycleCommands().addMaxHeap(commandLine, StringUtils.EMPTY_STRING);
+ getLauncherLifecycleCommands().addMaxHeap(commandLine, StringUtils.EMPTY);
assertTrue(commandLine.isEmpty());
@@ -621,11 +630,11 @@ public class LauncherLifecycleCommandsTest {
}
private String toClasspath(final String... jarFilePathnames) {
- String classpath = StringUtils.EMPTY_STRING;
+ String classpath = StringUtils.EMPTY;
if (jarFilePathnames != null) {
for (final String jarFilePathname : jarFilePathnames) {
- classpath += (classpath.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
+ classpath += (classpath.isEmpty() ? StringUtils.EMPTY : File.pathSeparator);
classpath += jarFilePathname;
}
}
@@ -637,7 +646,7 @@ public class LauncherLifecycleCommandsTest {
String path = "";
for (Object pathElement : pathElements) {
- path += (path.isEmpty() ? StringUtils.EMPTY_STRING : File.pathSeparator);
+ path += (path.isEmpty() ? StringUtils.EMPTY : File.pathSeparator);
path += pathElement;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
index f2e90a4..4529f2c 100644
--- a/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
+++ b/geode-assembly/src/test/java/org/apache/geode/rest/internal/web/controllers/RestAPITestBase.java
@@ -14,36 +14,21 @@
*/
package org.apache.geode.rest.internal.web.controllers;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.test.dunit.Assert.*;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.json.JSONArray;
-import org.junit.experimental.categories.Category;
-
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.fail;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionService;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.AgentUtil;
import org.apache.geode.rest.internal.web.RestFunctionTemplate;
import org.apache.geode.test.dunit.Host;
@@ -51,6 +36,25 @@ import org.apache.geode.test.dunit.Invoke;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONArray;
+import org.junit.experimental.categories.Category;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
@Category(DistributedTest.class)
class RestAPITestBase extends JUnit4DistributedTestCase {
@@ -168,7 +172,7 @@ class RestAPITestBase extends JUnit4DistributedTestCase {
HttpPost post = new HttpPost(restString);
post.addHeader("Content-Type", "application/json");
post.addHeader("Accept", "application/json");
- if (jsonBody != null && !StringUtils.isEmpty(jsonBody)) {
+ if (StringUtils.isNotEmpty(jsonBody)) {
StringEntity jsonStringEntity = new StringEntity(jsonBody, ContentType.DEFAULT_TEXT);
post.setEntity(jsonStringEntity);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
index d531cc1..677db4d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/locator/LocatorStatusResponse.java
@@ -15,6 +15,13 @@
package org.apache.geode.cache.client.internal.locator;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.lang.ObjectUtils;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.process.PidUnavailableException;
+import org.apache.geode.internal.process.ProcessUtils;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -24,13 +31,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.process.PidUnavailableException;
-import org.apache.geode.internal.process.ProcessUtils;
-
/**
* The LocatorStatusResponse class...
* </p>
@@ -101,7 +101,7 @@ public class LocatorStatusResponse extends ServerLocationResponse {
@SuppressWarnings("unchecked")
public List<String> getJvmArgs() {
return Collections
- .unmodifiableList(ObjectUtils.defaultIfNull(jvmArgs, Collections.<String>emptyList()));
+ .unmodifiableList(ObjectUtils.defaultIfNull(jvmArgs, Collections.emptyList()));
}
public Integer getPid() {
@@ -162,12 +162,12 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readWorkingDirectory(final DataInput in) throws IOException {
- this.workingDirectory = StringUtils.defaultIfBlank(in.readUTF());
+ this.workingDirectory = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readJvmArguments(final DataInput in) throws IOException {
final int length = in.readInt();
- final List<String> jvmArgs = new ArrayList<String>(length);
+ final List<String> jvmArgs = new ArrayList<>(length);
for (int index = 0; index < length; index++) {
jvmArgs.add(in.readUTF());
}
@@ -175,23 +175,23 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readClasspath(final DataInput in) throws IOException {
- this.classpath = StringUtils.defaultIfBlank(in.readUTF());
+ this.classpath = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readGemFireVersion(final DataInput in) throws IOException {
- this.gemfireVersion = StringUtils.defaultIfBlank(in.readUTF());
+ this.gemfireVersion = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readJavaVersion(final DataInput in) throws IOException {
- this.javaVersion = StringUtils.defaultIfBlank(in.readUTF());
+ this.javaVersion = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readLogFile(final DataInput in) throws IOException {
- this.logFile = StringUtils.defaultIfBlank(in.readUTF());
+ this.logFile = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readHost(final DataInput in) throws IOException {
- this.host = StringUtils.defaultIfBlank(in.readUTF());
+ this.host = StringUtils.nullifyIfBlank(in.readUTF());
}
protected void readPort(final DataInput in) throws IOException {
@@ -200,7 +200,7 @@ public class LocatorStatusResponse extends ServerLocationResponse {
}
protected void readName(final DataInput in) throws IOException {
- this.name = StringUtils.defaultIfBlank(in.readUTF());
+ this.name = StringUtils.nullifyIfBlank(in.readUTF());
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
index f40ab3e..5bfba0e 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/AttributeDescriptor.java
@@ -15,6 +15,19 @@
package org.apache.geode.cache.query.internal;
+import org.apache.geode.cache.EntryDestroyedException;
+import org.apache.geode.cache.query.NameNotFoundException;
+import org.apache.geode.cache.query.QueryInvocationTargetException;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.types.ObjectType;
+import org.apache.geode.internal.cache.Token;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.pdx.JSONFormatter;
+import org.apache.geode.pdx.PdxInstance;
+import org.apache.geode.pdx.PdxSerializationException;
+import org.apache.geode.pdx.internal.FieldNotFoundInPdxVersion;
+import org.apache.geode.pdx.internal.PdxInstanceImpl;
+
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -28,19 +41,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.geode.cache.EntryDestroyedException;
-import org.apache.geode.cache.query.NameNotFoundException;
-import org.apache.geode.cache.query.QueryInvocationTargetException;
-import org.apache.geode.cache.query.QueryService;
-import org.apache.geode.cache.query.types.ObjectType;
-import org.apache.geode.internal.cache.Token;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.pdx.PdxInstance;
-import org.apache.geode.pdx.PdxSerializationException;
-import org.apache.geode.pdx.internal.FieldNotFoundInPdxVersion;
-import org.apache.geode.pdx.internal.PdxInstanceImpl;
-import org.apache.geode.pdx.JSONFormatter;
-
/**
* Utility for managing an attribute
*
@@ -137,25 +137,6 @@ public class AttributeDescriptor {
}
- /* this method is not yet used. Here to support Update statements */
- // returns either null or UNDEFINED
- /*
- * public Object write(Object target, Object newValue) throws PathEvaluationException { if (target
- * == null) return QueryService.UNDEFINED;
- *
- *
- * Class targetType = target.getClass(); Class argType = newValue == null ? null :
- * newValue.getClass(); Member m = getWriteMember(targetType, argType); if (m == null) throw new
- * PathEvaluationException(LocalizedStrings.AttributeDescriptor_NO_UPDATE_PATH_MAPPING_FOUND_FOR_0
- * .toLocalizedString(_name)); try { if (m instanceof Method) { try { ((Method)m).invoke(target,
- * new Object[] { newValue }); return null; } catch (InvocationTargetException e) { throw new
- * PathEvaluationException(e.getTargetException()); } } else { ((Field)m).set(target, newValue);
- * return null; } } catch (IllegalAccessException e) { throw new PathEvaluationException(e)); }
- *
- * }
- */
-
-
Member getReadMember(ObjectType targetType) throws NameNotFoundException {
return getReadMember(targetType.resolveClass());
}
@@ -186,14 +167,6 @@ public class AttributeDescriptor {
}
- /*
- * Not yet used, Here to support Update statements private Member getWriteMember(Class targetType,
- * Class argType) { // mapping: public field (same name), method (setAttribute(val)), // method
- * attribute(val) Member m; m = getWriteField(targetType, argType); if (m != null) return m;
- * return getWriteMethod(targetType, argType); }
- */
-
-
private Field getReadField(Class targetType) {
try {
@@ -203,11 +176,6 @@ public class AttributeDescriptor {
}
}
- /*
- * not yet used private Field getWriteField(Class targetType, Class argType) { try { return
- * targetType.getField(_name); } catch (NoSuchFieldException e) { return null; } }
- */
-
private Method getReadMethod(Class targetType) {
@@ -219,12 +187,6 @@ public class AttributeDescriptor {
return getReadMethod(targetType, _name);
}
- /*
- * not yet used private Method getWriteMethod(Class targetType, Class argType) { Method m; String
- * beanMethod = "set" + _name.substring(0,1).toUpperCase() + _name.substring(1); m =
- * getWriteMethod(targetType, argType, beanMethod); if (m != null) return m; return
- * getWriteMethod(targetType, argType, _name); }
- */
private Method getReadMethod(Class targetType, String methodName) {
@@ -236,12 +198,6 @@ public class AttributeDescriptor {
}
}
- /*
- * not yet used private Method getWriteMethod(Class targetType, Class argType, String methodName)
- * { try { // @todo look up maximally specific method based on argType return
- * targetType.getMethod(methodName, new Class[] { argType }); } catch (NoSuchMethodException e) {
- * return null; } }
- */
/**
* reads field value from a PdxInstance
*
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
index 4e52a67..1a267d8 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java
@@ -14,19 +14,6 @@
*/
package org.apache.geode.cache.query.internal;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.AbstractCollection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
import org.apache.geode.DataSerializer;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.Struct;
@@ -40,6 +27,19 @@ import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.HeapDataOutputStream.LongUpdater;
import org.apache.geode.internal.Version;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
/**
* The n - way merge results returns a sorted results on the cumulative sorted results for
* partitioned region based query
@@ -210,11 +210,6 @@ public class NWayMergeResults<E> implements SelectResults<E>, Ordered, DataSeria
}
- /*
- * @Override public boolean isEmpty() { boolean isEmpty = true; for (SelectResults<E> result :
- * this.sortedResults) { isEmpty = result.isEmpty(); if (!isEmpty) { break; } } return isEmpty;
- * }
- */
@Override
public Iterator<E> iterator() {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
index feba893..007a990 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/AbstractLauncher.java
@@ -37,14 +37,11 @@ import org.apache.geode.management.internal.cli.json.GfJsonObject;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.net.BindException;
import java.net.InetAddress;
import java.net.URL;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -144,7 +141,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @see java.util.Properties
*/
protected static boolean isSet(final Properties properties, final String propertyName) {
- return !StringUtils.isBlank(properties.getProperty(propertyName));
+ return StringUtils.isNotBlank(properties.getProperty(propertyName));
}
/**
@@ -243,7 +240,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
distributedSystemProperties.putAll(defaults);
}
- if (!StringUtils.isBlank(getMemberName())) {
+ if (StringUtils.isNotBlank(getMemberName())) {
distributedSystemProperties.setProperty(NAME, getMemberName());
}
@@ -291,7 +288,13 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @see #getMemberId()
*/
public String getMember() {
- return StringUtils.defaultIfBlank(getMemberName(), getMemberId());
+ if (StringUtils.isNotBlank(getMemberName())) {
+ return getMemberName();
+ }
+ if (StringUtils.isNotBlank(getMemberId())) {
+ return getMemberId();
+ }
+ return null;
}
/**
@@ -501,7 +504,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
// TODO refactor the logic in this method into a DateTimeFormatUtils class
protected static String toDaysHoursMinutesSeconds(final Long milliseconds) {
- final StringBuilder buffer = new StringBuilder(StringUtils.EMPTY_STRING);
+ final StringBuilder buffer = new StringBuilder();
if (milliseconds != null) {
long millisecondsRemaining = milliseconds;
@@ -569,7 +572,7 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
* @return a String value containing the JSON representation of this state object.
*/
public String toJson() {
- final Map<String, Object> map = new HashMap<String, Object>();
+ final Map<String, Object> map = new HashMap<>();
map.put(JSON_CLASSPATH, getClasspath());
map.put(JSON_GEMFIREVERSION, getGemFireVersion());
map.put(JSON_HOST, getHost());
@@ -778,12 +781,12 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
// the value of a Number as a String, or "" if null
protected String toString(final Number value) {
- return StringUtils.valueOf(value, "");
+ return StringUtils.defaultString(value);
}
// a String concatenation of all values separated by " "
protected String toString(final Object... values) {
- return StringUtils.concat(values, " ");
+ return values == null ? "" : StringUtils.join(values, " ");
}
// the value of the String, or "" if value is null
@@ -805,8 +808,8 @@ public abstract class AbstractLauncher<T extends Comparable<T>> implements Runna
private final String description;
Status(final String description) {
- assert !StringUtils.isBlank(description) : "The Status description must be specified!";
- this.description = StringUtils.toLowerCase(description);
+ assert StringUtils.isNotBlank(description) : "The Status description must be specified!";
+ this.description = StringUtils.lowerCase(description);
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
index 641e009..68aa9db 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/LocatorLauncher.java
@@ -15,32 +15,42 @@
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import org.apache.geode.cache.client.internal.locator.*;
+import org.apache.geode.cache.client.internal.locator.LocatorStatusRequest;
+import org.apache.geode.cache.client.internal.locator.LocatorStatusResponse;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.DistributionConfigImpl;
import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.distributed.internal.tcpserver.*;
+import org.apache.geode.distributed.internal.tcpserver.TcpClient;
import org.apache.geode.internal.DistributionLocator;
import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.lang.ObjectUtils;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
-import org.apache.geode.internal.process.*;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.process.ConnectionFailedException;
+import org.apache.geode.internal.process.ControlNotificationHandler;
+import org.apache.geode.internal.process.ControllableProcess;
+import org.apache.geode.internal.process.FileAlreadyExistsException;
+import org.apache.geode.internal.process.MBeanInvocationFailedException;
+import org.apache.geode.internal.process.PidUnavailableException;
+import org.apache.geode.internal.process.ProcessController;
+import org.apache.geode.internal.process.ProcessControllerFactory;
+import org.apache.geode.internal.process.ProcessControllerParameters;
+import org.apache.geode.internal.process.ProcessLauncherContext;
+import org.apache.geode.internal.process.ProcessType;
+import org.apache.geode.internal.process.ProcessUtils;
+import org.apache.geode.internal.process.StartupStatusListener;
+import org.apache.geode.internal.process.UnableToControlProcessException;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.lang.AttachAPINotFoundException;
import org.apache.geode.management.internal.cli.json.GfJsonArray;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -48,12 +58,23 @@ import java.lang.management.ManagementFactory;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import joptsimple.OptionException;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
/**
* The LocatorLauncher class is a launcher for a GemFire Locator.
@@ -1563,7 +1584,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getHostnameForClients()
*/
public Builder setHostnameForClients(final String hostnameForClients) {
- if (StringUtils.isEmpty(StringUtils.trim(hostnameForClients))) {
+ if (StringUtils.isBlank(hostnameForClients)) {
throw new IllegalArgumentException(
LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
.toLocalizedString());
@@ -1591,7 +1612,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* @see #getMemberName()
*/
public Builder setMemberName(final String memberName) {
- if (StringUtils.isEmpty(StringUtils.trim(memberName))) {
+ if (StringUtils.isBlank(memberName)) {
throw new IllegalArgumentException(
LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE
.toLocalizedString("Locator"));
@@ -1707,7 +1728,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
}
boolean isWorkingDirectorySpecified() {
- return !StringUtils.isBlank(this.workingDirectory);
+ return StringUtils.isNotBlank(this.workingDirectory);
}
/**
@@ -1931,7 +1952,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
* option.
*/
public boolean hasOption(final String option) {
- return getOptions().contains(StringUtils.toLowerCase(option));
+ return getOptions().contains(StringUtils.lowerCase(option));
}
/**
@@ -2043,8 +2064,9 @@ public class LocatorLauncher extends AbstractLauncher<String> {
if (logFile != null && logFile.isFile()) {
final String logFileCanonicalPath =
IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile);
- if (!StringUtils.isBlank(logFileCanonicalPath)) { // this is probably not need but a safe
- // check none-the-less.
+ if (StringUtils.isNotBlank(logFileCanonicalPath)) { // this is probably not need but a
+ // safe
+ // check none-the-less.
return logFileCanonicalPath;
}
}
@@ -2056,7 +2078,7 @@ public class LocatorLauncher extends AbstractLauncher<String> {
if (InternalLocator.hasLocator()) {
final InternalLocator locator = InternalLocator.getLocator();
final String portAsString = String.valueOf(locator.getPort());
- if (!StringUtils.isBlank(portAsString)) {
+ if (StringUtils.isNotBlank(portAsString)) {
return portAsString;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
index b2d0151..acd5e8a 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/ServerLauncher.java
@@ -15,33 +15,9 @@
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.ServiceLoader;
-import java.util.TreeMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.distributed.ConfigurationProperties.SERVER_BIND_ADDRESS;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
@@ -87,6 +63,30 @@ import org.apache.geode.pdx.PdxSerializer;
import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.security.GemFireSecurityException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import joptsimple.OptionException;
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+
/**
* The ServerLauncher class is a launcher class with main method to start a GemFire Server (implying
* a GemFire Cache Server process).
@@ -366,7 +366,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
final StringBuilder buffer = new StringBuilder(ServerState.getServerBindAddressAsString(this));
final String serverPort = ServerState.getServerPortAsString(this);
- if (!StringUtils.isBlank(serverPort)) {
+ if (StringUtils.isNotBlank(serverPort)) {
buffer.append("[").append(serverPort).append("]");
}
@@ -590,7 +590,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* configuration meta-data.
*/
public boolean isSpringXmlLocationSpecified() {
- return !StringUtils.isBlank(this.springXmlLocation);
+ return StringUtils.isNotBlank(this.springXmlLocation);
}
/**
@@ -1956,7 +1956,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* @see #getMemberName()
*/
public Builder setMemberName(final String memberName) {
- if (StringUtils.isEmpty(StringUtils.trim(memberName))) {
+ if (StringUtils.isBlank(memberName)) {
throw new IllegalArgumentException(
LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE
.toLocalizedString("Server"));
@@ -2496,7 +2496,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
private final String name;
Command(final String name, final String... options) {
- assert !StringUtils.isBlank(name) : "The name of the command must be specified!";
+ assert StringUtils.isNotBlank(name) : "The name of the command must be specified!";
this.name = name;
this.options = (options != null ? Collections.unmodifiableList(Arrays.asList(options))
: Collections.<String>emptyList());
@@ -2572,7 +2572,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
* option.
*/
public boolean hasOption(final String option) {
- return getOptions().contains(StringUtils.toLowerCase(option));
+ return getOptions().contains(StringUtils.lowerCase(option));
}
/**
@@ -2678,7 +2678,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (logFile != null && logFile.isFile()) {
final String logFileCanonicalPath =
IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile);
- if (!StringUtils.isBlank(logFileCanonicalPath)) {
+ if (StringUtils.isNotBlank(logFileCanonicalPath)) {
return logFileCanonicalPath;
}
}
@@ -2696,7 +2696,7 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String serverBindAddressAsString = cs.getBindAddress();
- if (!StringUtils.isBlank(serverBindAddressAsString)) {
+ if (StringUtils.isNotBlank(serverBindAddressAsString)) {
return serverBindAddressAsString;
}
}
@@ -2714,13 +2714,13 @@ public class ServerLauncher extends AbstractLauncher<String> {
if (csList != null && !csList.isEmpty()) {
final CacheServer cs = csList.get(0);
final String portAsString = String.valueOf(cs.getPort());
- if (!StringUtils.isBlank(portAsString)) {
+ if (StringUtils.isNotBlank(portAsString)) {
return portAsString;
}
}
}
- return (launcher.isDisableDefaultServer() ? StringUtils.EMPTY_STRING
+ return (launcher.isDisableDefaultServer() ? StringUtils.EMPTY
: launcher.getServerPortAsString());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
index 10623b4..d990015 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterConfigurationService.java
@@ -14,41 +14,14 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Path;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactoryConfigurationError;
+import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_CONFIGURATION_DIR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.CacheLoaderException;
@@ -69,7 +42,6 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberID;
import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.configuration.callbacks.ConfigurationChangeListener;
@@ -81,6 +53,34 @@ import org.apache.geode.management.internal.configuration.messages.Configuration
import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
@SuppressWarnings({"deprecation", "unchecked"})
public class ClusterConfigurationService {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index ad5e04d..6500385 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -14,26 +14,11 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.logging.log4j.Logger;
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.GemFireCache;
@@ -69,7 +54,6 @@ import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.logging.log4j.LogWriterAppenders;
-import org.apache.geode.internal.logging.log4j.LogWriterLogger;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.management.internal.JmxManagerLocator;
@@ -81,6 +65,22 @@ import org.apache.geode.management.internal.configuration.handlers.SharedConfigu
import org.apache.geode.management.internal.configuration.messages.ConfigurationRequest;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusRequest;
import org.apache.geode.management.internal.configuration.messages.SharedConfigurationStatusResponse;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Provides the implementation of a distribution {@code Locator} as well as internal-only
@@ -675,7 +675,7 @@ public class InternalLocator extends Locator implements ConnectListener {
// this.logger.config("ensuring that this locator is in the locators list");
boolean setLocatorsProp = false;
String locatorsProp = this.config.getLocators();
- if (locatorsProp != null && !locatorsProp.trim().isEmpty()) {
+ if (StringUtils.isNotBlank(locatorsProp)) {
if (!locatorsProp.contains(thisLocator)) {
locatorsProp = locatorsProp + ',' + thisLocator;
setLocatorsProp = true;
@@ -756,7 +756,7 @@ public class InternalLocator extends Locator implements ConnectListener {
*
* @since GemFire 5.7
*/
- void endStartLocator(InternalDistributedSystem distributedSystem) throws UnknownHostException {
+ void endStartLocator(InternalDistributedSystem distributedSystem) {
this.env = null;
if (distributedSystem == null) {
distributedSystem = InternalDistributedSystem.getConnectedInstance();
@@ -1262,7 +1262,7 @@ public class InternalLocator extends Locator implements ConnectListener {
public Object processRequest(Object request) throws IOException {
long giveup = 0;
while (giveup == 0 || System.currentTimeMillis() < giveup) {
- TcpHandler handler = null;
+ TcpHandler handler;
if (request instanceof PeerLocatorRequest) {
handler = this.handlerMapping.get(PeerLocatorRequest.class);
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 9dc7fe2..478c4e8 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -14,33 +14,20 @@
*/
package org.apache.geode.distributed.internal.membership.gms.membership;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.apache.geode.distributed.internal.membership.gms.ServiceConfig.*;
-import static org.apache.geode.internal.DataSerializableFixedID.*;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TimerTask;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.logging.log4j.Logger;
-
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static org.apache.geode.distributed.internal.membership.gms.ServiceConfig.MEMBER_REQUEST_COLLECTION_INTERVAL;
+import static org.apache.geode.internal.DataSerializableFixedID.FIND_COORDINATOR_REQ;
+import static org.apache.geode.internal.DataSerializableFixedID.FIND_COORDINATOR_RESP;
+import static org.apache.geode.internal.DataSerializableFixedID.INSTALL_VIEW_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.JOIN_REQUEST;
+import static org.apache.geode.internal.DataSerializableFixedID.JOIN_RESPONSE;
+import static org.apache.geode.internal.DataSerializableFixedID.LEAVE_REQUEST_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.NETWORK_PARTITION_MESSAGE;
+import static org.apache.geode.internal.DataSerializableFixedID.REMOVE_MEMBER_REQUEST;
+import static org.apache.geode.internal.DataSerializableFixedID.VIEW_ACK_MESSAGE;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.GemFireConfigException;
import org.apache.geode.SystemConnectException;
import org.apache.geode.distributed.DistributedMember;
@@ -72,6 +59,28 @@ import org.apache.geode.internal.Version;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TimerTask;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* GMSJoinLeave handles membership communication with other processes in the distributed system. It
@@ -1627,8 +1636,8 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
this.services = s;
DistributionConfig dc = services.getConfig().getDistributionConfig();
- if (dc.getMcastPort() != 0 && dc.getLocators().trim().isEmpty()
- && dc.getStartLocator().trim().isEmpty()) {
+ if (dc.getMcastPort() != 0 && StringUtils.isBlank(dc.getLocators())
+ && StringUtils.isBlank(dc.getStartLocator())) {
throw new GemFireConfigException("Multicast cannot be configured for a non-distributed cache."
+ " Please configure the locator services for this cache using " + LOCATORS + " or "
+ START_LOCATOR + ".");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index 78b2944..019c35c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -14,56 +14,7 @@
*/
package org.apache.geode.internal;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.EOFException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.NotSerializableException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.io.UTFDataFormatException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.CancelException;
import org.apache.geode.CanonicalInstantiator;
import org.apache.geode.DataSerializable;
@@ -115,6 +66,55 @@ import org.apache.geode.pdx.internal.PdxReaderImpl;
import org.apache.geode.pdx.internal.PdxType;
import org.apache.geode.pdx.internal.PdxWriterImpl;
import org.apache.geode.pdx.internal.TypeRegistry;
+import org.apache.logging.log4j.Logger;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.EOFException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.io.UTFDataFormatException;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Stack;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
/**
* Contains static methods for data serializing instances of internal GemFire classes. It also
@@ -879,8 +879,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
// send it to cache servers if it is a client
sendRegistrationMessageToServers(s);
}
- // send it to all cache clients irelevent of distribute
- // bridge servers send it all the clients irelevent of
+ // send it to all cache clients irrelevant of distribute
+ // bridge servers send it all the clients irrelevant of
// originator VM
sendRegistrationMessageToClients(s);
@@ -918,7 +918,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
private static void register(String className, boolean distribute,
SerializerAttributesHolder holder) {
- if (className == null || className.trim().isEmpty()) {
+ if (StringUtils.isBlank(className)) {
throw new IllegalArgumentException("Class name cannot be null or empty.");
}
@@ -1062,9 +1062,9 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
if (o instanceof DataSerializer) {
DataSerializer s = (DataSerializer) o;
Class[] classes = s.getSupportedClasses();
- for (int i = 0; i < classes.length; i++) {
- classesToSerializers.remove(classes[i].getName(), s);
- supportedClassesToHolders.remove(classes[i].getName());
+ for (Class aClass : classes) {
+ classesToSerializers.remove(aClass.getName(), s);
+ supportedClassesToHolders.remove(aClass.getName());
}
dsClassesToHolders.remove(s.getClass().getName());
idsToHolders.remove(idx);
@@ -1185,7 +1185,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
SerializerAttributesHolder holder = entry.getValue();
try {
Class cl = getCachedClass(name);
- DataSerializer ds = null;
+ DataSerializer ds;
if (holder.getEventId() != null) {
ds = register(cl, false, holder.getEventId(), holder.getProxyId());
} else {
@@ -1404,13 +1404,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
try {
invokeToData(o, out);
- } catch (IOException io) {
+ } catch (IOException | CancelException | ToDataException | GemFireRethrowable io) {
// Note: this is not a user code toData but one from our
// internal code since only GemFire product code implements DSFID
- throw io;
- } catch (CancelException | ToDataException | GemFireRethrowable ex) {
+
// Serializing a PDX can result in a cache closed exception. Just rethrow
- throw ex;
+
+ throw io;
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
@@ -1726,7 +1726,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
final int size = readArrayLength(in);
if (size >= 0) {
for (int index = 0; index < size; ++index) {
- E element = DataSerializer.<E>readObject(in);
+ E element = DataSerializer.readObject(in);
c.add(element);
}
@@ -2582,7 +2582,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
}
- public static int readDSFIDHeader(final DataInput in) throws IOException, ClassNotFoundException {
+ public static int readDSFIDHeader(final DataInput in) throws IOException {
checkIn(in);
byte header = in.readByte();
if (header == DS_FIXED_ID_BYTE) {
@@ -2666,11 +2666,11 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
throws IOException, ClassNotFoundException {
boolean wouldReadSerialized = PdxInstanceImpl.getPdxReadSerialized();
if (!wouldReadSerialized) {
- return DataSerializer.<T>readObject(in);
+ return DataSerializer.readObject(in);
} else {
PdxInstanceImpl.setPdxReadSerialized(false);
try {
- return DataSerializer.<T>readObject(in);
+ return DataSerializer.readObject(in);
} finally {
PdxInstanceImpl.setPdxReadSerialized(true);
}
@@ -2878,7 +2878,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
}
private static Object readUserDataSerializable(final DataInput in, int classId)
- throws IOException, ClassNotFoundException {
+ throws IOException {
Instantiator instantiator = InternalInstantiator.getInstantiator(classId);
if (instantiator == null) {
logger.error(LogMarker.SERIALIZER,
@@ -3698,7 +3698,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
synchronized (cacheAccessLock) {
Class<?> cachedClass = getExistingCachedClass(className);
if (cachedClass == null) {
- classCache.put(className, new WeakReference<Class<?>>(result));
+ classCache.put(className, new WeakReference<>(result));
} else {
result = cachedClass;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
index af3cb5d..1dc2fd1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteTransportConfig.java
@@ -14,7 +14,21 @@
*/
package org.apache.geode.internal.admin.remote;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.BIND_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_AUTO_RECONNECT;
+import static org.apache.geode.distributed.ConfigurationProperties.DISABLE_TCP;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_ADDRESS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.MEMBERSHIP_PORT_RANGE;
+import static org.apache.geode.distributed.ConfigurationProperties.TCP_PORT;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.admin.TransportConfig;
+import org.apache.geode.internal.i18n.LocalizedStrings;
import java.util.Collection;
import java.util.Collections;
@@ -24,13 +38,6 @@ import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.admin.SSLConfig;
-import org.apache.geode.internal.admin.TransportConfig;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* Tranport config for RemoteGfManagerAgent.
*/
@@ -99,7 +106,7 @@ public class RemoteTransportConfig implements TransportConfig {
StringTokenizer stringTokenizer = new StringTokenizer(initialHosts, ",");
while (stringTokenizer.hasMoreTokens()) {
String locator = stringTokenizer.nextToken();
- if (!StringUtils.isEmpty(locator)) {
+ if (StringUtils.isNotEmpty(locator)) {
locators.add(new DistributionLocatorId(locator));
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
index 55e3542..37f2120 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ClusterConfigurationLoader.java
@@ -17,41 +17,40 @@ package org.apache.geode.internal.cache;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.stream.Stream;
-
import org.apache.commons.lang.ArrayUtils;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.UnmodifiableException;
import org.apache.geode.cache.Cache;
-import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.tcpserver.TcpClient;
+import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.ConfigSource;
import org.apache.geode.internal.DeployedJar;
import org.apache.geode.internal.JarDeployer;
import org.apache.geode.internal.admin.remote.DistributionLocatorId;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.process.ClusterConfigurationNotAvailableException;
import org.apache.geode.management.internal.configuration.domain.Configuration;
import org.apache.geode.management.internal.configuration.messages.ConfigurationRequest;
import org.apache.geode.management.internal.configuration.messages.ConfigurationResponse;
+import org.apache.logging.log4j.Logger;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.stream.Stream;
public class ClusterConfigurationLoader {
@@ -121,7 +120,7 @@ public class ClusterConfigurationLoader {
requestedConfiguration.get(ClusterConfigurationService.CLUSTER_CONFIG);
if (clusterConfiguration != null) {
String cacheXmlContent = clusterConfiguration.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
cacheXmlContentList.add(cacheXmlContent);
}
}
@@ -131,7 +130,7 @@ public class ClusterConfigurationLoader {
Configuration groupConfiguration = requestedConfiguration.get(group);
if (groupConfiguration != null) {
String cacheXmlContent = groupConfiguration.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
cacheXmlContentList.add(cacheXmlContent);
}
}
@@ -230,7 +229,7 @@ public class ClusterConfigurationLoader {
String ipaddress = dlId.getBindAddress();
InetAddress locatorInetAddress = null;
- if (!StringUtils.isBlank(ipaddress)) {
+ if (StringUtils.isNotBlank(ipaddress)) {
locatorInetAddress = InetAddress.getByName(ipaddress);
} else {
locatorInetAddress = dlId.getHost();
@@ -265,7 +264,7 @@ public class ClusterConfigurationLoader {
private static List<String> getGroups(DistributionConfig config) {
String groupString = config.getGroups();
List<String> groups = new ArrayList<String>();
- if (!StringUtils.isBlank(groupString)) {
+ if (StringUtils.isNotBlank(groupString)) {
groups.addAll((Arrays.asList(groupString.split(","))));
}
return groups;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
index 185fde7..69684a3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EntryEventImpl.java
@@ -14,16 +14,8 @@
*/
package org.apache.geode.internal.cache;
-import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.function.Function;
-
-import org.apache.logging.log4j.Logger;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_NEW_VALUE;
+import static org.apache.geode.internal.offheap.annotations.OffHeapIdentifier.ENTRY_EVENT_OLD_VALUE;
import org.apache.geode.CopyHelper;
import org.apache.geode.DataSerializer;
@@ -83,6 +75,14 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.logging.log4j.Logger;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.function.Function;
/**
* Implementation of an entry event
[18/28] geode git commit: Cleanup CacheClientNotifier
Posted by kl...@apache.org.
Cleanup CacheClientNotifier
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/f43c7780
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/f43c7780
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/f43c7780
Branch: refs/heads/feature/GEODE-2632-16
Commit: f43c77806089affe9f69e37402116162e49743d9
Parents: 97a6e1a
Author: Kirk Lund <kl...@apache.org>
Authored: Thu May 18 13:28:38 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:58:24 2017 -0700
----------------------------------------------------------------------
.../cache/tier/sockets/CacheClientNotifier.java | 1160 ++++++++----------
.../cache/tier/sockets/CacheClientProxy.java | 4 +-
2 files changed, 542 insertions(+), 622 deletions(-)
----------------------------------------------------------------------
[16/28] geode git commit: Cleanup CacheClientNotifier
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/f43c7780/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 75c89ab..8450db9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -1951,7 +1951,7 @@ public class CacheClientProxy implements ClientSession {
// Close the proxy
terminateDispatching(false);
- _cacheClientNotifier._statistics.incQueueDroppedCount();
+ _cacheClientNotifier.statistics.incQueueDroppedCount();
/**
* Setting the expiration task to null again and cancelling existing one, if any. See
@@ -2850,7 +2850,7 @@ public class CacheClientProxy implements ClientSession {
try {
this._messageQueue.put(clientMessage);
if (this._proxy.isPaused() && this._proxy.isDurable()) {
- this._proxy._cacheClientNotifier._statistics.incEventEnqueuedWhileClientAwayCount();
+ this._proxy._cacheClientNotifier.statistics.incEventEnqueuedWhileClientAwayCount();
if (logger.isDebugEnabled()) {
logger.debug("{}: Queued message while Durable Client is away {}", this, clientMessage);
}
[03/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
index 7bd7462..d3c1200 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherIntegrationTest.java
@@ -14,6 +14,12 @@
*/
package org.apache.geode.distributed;
+import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
+import static com.googlecode.catchexception.apis.BDDCatchException.when;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.BDDAssertions.then;
+
import org.apache.geode.distributed.ServerLauncher.Builder;
import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -32,12 +38,6 @@ import java.io.FileWriter;
import java.net.InetAddress;
import java.util.Properties;
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* Integration tests for ServerLauncher class. These tests may require file system and/or network
* I/O.
@@ -157,7 +157,7 @@ public class ServerLauncherIntegrationTest {
gemfireProperties);
// when: starting with null MemberName
- ServerLauncher launcher = new Builder().setCommand(Command.START).setMemberName(null).build();
+ ServerLauncher launcher = new Builder().setCommand(Command.START).build();
// then: name in gemfire.properties file should be used for MemberName
assertThat(launcher).isNotNull();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index f5d6271..98f73d8 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -14,17 +14,24 @@
*/
package org.apache.geode.distributed;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.distributed.ServerLauncher.Builder;
import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.support.DistributedSystemAdapter;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import edu.umd.cs.mtc.MultithreadedTestCase;
-import edu.umd.cs.mtc.TestFramework;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.concurrent.Synchroniser;
@@ -42,9 +49,8 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.junit.Assert.*;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import edu.umd.cs.mtc.MultithreadedTestCase;
+import edu.umd.cs.mtc.TestFramework;
/**
* The ServerLauncherTest class is a test suite of unit tests testing the contract, functionality
@@ -77,6 +83,7 @@ public class ServerLauncherTest {
setThreadingPolicy(new Synchroniser());
}
};
+ DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
}
@After
@@ -162,8 +169,6 @@ public class ServerLauncherTest {
assertNull(builder.getMemberName());
assertSame(builder, builder.setMemberName("serverOne"));
assertEquals("serverOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
}
@Test(expected = IllegalArgumentException.class)
@@ -190,6 +195,18 @@ public class ServerLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameToNullString() {
+ try {
+ new Builder().setMemberName(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Server"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetPid() {
Builder builder = new Builder();
@@ -277,8 +294,6 @@ public class ServerLauncherTest {
assertNull(builder.getHostNameForClients());
assertSame(builder, builder.setHostNameForClients("Pegasus"));
assertEquals("Pegasus", builder.getHostNameForClients());
- assertSame(builder, builder.setHostNameForClients(null));
- assertNull(builder.getHostNameForClients());
}
@Test
@@ -498,8 +513,8 @@ public class ServerLauncherTest {
@Test
public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- ServerLauncher launcher = new Builder().setCommand(ServerLauncher.Command.START)
- .setMemberName(null).set(NAME, "serverABC").build();
+ ServerLauncher launcher =
+ new Builder().setCommand(ServerLauncher.Command.START).set(NAME, "serverABC").build();
assertNotNull(launcher);
assertEquals(ServerLauncher.Command.START, launcher.getCommand());
@@ -511,8 +526,7 @@ public class ServerLauncherTest {
public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + NAME, "serverXYZ");
- ServerLauncher launcher =
- new Builder().setCommand(ServerLauncher.Command.START).setMemberName(null).build();
+ ServerLauncher launcher = new Builder().setCommand(ServerLauncher.Command.START).build();
assertNotNull(launcher);
assertEquals(ServerLauncher.Command.START, launcher.getCommand());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
index 3ec3b06..cc83faa 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/ClassUtilsJUnitTest.java
@@ -14,15 +14,17 @@
*/
package org.apache.geode.internal.lang;
-import static org.junit.Assert.*;
-
-import java.util.Calendar;
-import java.util.Date;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.test.junit.categories.UnitTest;
+import java.util.Calendar;
+import java.util.Date;
/**
* The ClassUtilsJUnitTest class is a test suite with test cases to test the contract and
@@ -61,8 +63,7 @@ public class ClassUtilsJUnitTest {
@Test(expected = IllegalArgumentException.class)
public void testForNameWithEmptyClassName() {
try {
- ClassUtils.forName(StringUtils.EMPTY_STRING,
- new IllegalArgumentException("Empty Class Name!"));
+ ClassUtils.forName(StringUtils.EMPTY, new IllegalArgumentException("Empty Class Name!"));
} catch (IllegalArgumentException expected) {
assertEquals("Empty Class Name!", expected.getMessage());
throw expected;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
index f3e0abe..503356a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/StringUtilsJUnitTest.java
@@ -14,19 +14,20 @@
*/
package org.apache.geode.internal.lang;
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
import org.apache.geode.DataSerializer;
import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.CachedDeserializableFactory;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
/**
* The StringUtilsJUnitTest is a test suite containing test cases for testing the contract and
@@ -42,55 +43,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
@Category(UnitTest.class)
public class StringUtilsJUnitTest {
- @Test
- public void testConcat() {
- assertEquals("", StringUtils.concat((Object[]) null));
- assertEquals("", StringUtils.concat(""));
- assertEquals(" ", StringUtils.concat(" "));
- assertEquals(" ", StringUtils.concat(" "));
- assertEquals("123", StringUtils.concat("123"));
- assertEquals("1 2 3", StringUtils.concat("1 2 3"));
- assertEquals(" 1 2 3 ", StringUtils.concat(" 1 2 3 "));
- assertEquals("trueC13.14159test", StringUtils.concat(true, 'C', 1, 3.14159f, "test"));
- assertEquals("test testing tested", StringUtils.concat("test", " testing", " tested"));
- }
- @Test
- public void testConcatWithDelimiter() {
- assertEquals("", StringUtils.concat(null, null));
- assertEquals("", StringUtils.concat(null, " "));
- assertEquals("", StringUtils.concat(new Object[] {""}, " "));
- assertEquals(" ", StringUtils.concat(new Object[] {" "}, " "));
- assertEquals(" ", StringUtils.concat(new Object[] {" ", " ", " "}, " "));
- assertEquals(" | | ", StringUtils.concat(new Object[] {" ", " ", " "}, "|"));
- assertEquals("abc", StringUtils.concat(new Object[] {"a", "b", "c"}, null));
- assertEquals("abc", StringUtils.concat(new Object[] {"a", "b", "c"}, ""));
- assertEquals("a b c", StringUtils.concat(new Object[] {"a", "b", "c"}, " "));
- assertEquals("a b c", StringUtils.concat(new Object[] {"a", "b", "c"}, " "));
- assertEquals("a_b_c", StringUtils.concat(new Object[] {"a", "b", "c"}, "_"));
- assertEquals("a|b|c", StringUtils.concat(new Object[] {"a", "b", "c"}, "|"));
- assertEquals("a>b>c", StringUtils.concat(new Object[] {"a", "b", "c"}, ">"));
- assertEquals("a&b&c", StringUtils.concat(new Object[] {"a", "b", "c"}, "&"));
- assertEquals("*", StringUtils.concat(new Object[] {"*"}, "*"));
- assertEquals("***", StringUtils.concat(new Object[] {"*", "*"}, "*"));
- assertEquals("*-*", StringUtils.concat(new Object[] {"*", "*"}, "-"));
- }
-
- @Test
- public void testDefaultIfBlank() {
- assertNull(StringUtils.defaultIfBlank((String[]) null));
- assertNull(null, StringUtils.defaultIfBlank(null, ""));
- assertNull(null, StringUtils.defaultIfBlank(null, "", " "));
- assertNull(null, StringUtils.defaultIfBlank(null, "", " ", "\0"));
- assertEquals("test", StringUtils.defaultIfBlank("test", null, "", " "));
- assertEquals("test", StringUtils.defaultIfBlank(null, "", " ", "test"));
- assertEquals("test", StringUtils.defaultIfBlank(null, "", "test", " ", null));
- assertEquals("_", StringUtils.defaultIfBlank("_", null, "", " "));
- assertEquals("empty", StringUtils.defaultIfBlank(null, "", "empty", " "));
- assertEquals("blank", StringUtils.defaultIfBlank(null, "", " ", "blank"));
- assertEquals("null", StringUtils.defaultIfBlank("null", null, "", " "));
- assertEquals("null", StringUtils.defaultIfBlank("null", "empty", "blank"));
- }
@Test
public void testGetDigitsOnly() {
@@ -107,186 +60,7 @@ public class StringUtilsJUnitTest {
assertEquals("123456789", StringUtils.getDigitsOnly("123,456.789"));
}
- @Test
- public void testGetLettersOnly() {
- assertEquals("", StringUtils.getLettersOnly(null));
- assertEquals("", StringUtils.getLettersOnly(""));
- assertEquals("", StringUtils.getLettersOnly(" "));
- assertEquals("", StringUtils.getLettersOnly("123"));
- assertEquals("", StringUtils.getLettersOnly("123@$$!"));
- assertEquals("", StringUtils.getLettersOnly("!@$$%#*?"));
- assertEquals("", StringUtils.getLettersOnly("10101"));
- assertEquals("lll", StringUtils.getLettersOnly("l0l0l"));
- assertEquals("", StringUtils.getLettersOnly("007"));
- assertEquals("OO", StringUtils.getLettersOnly("OO7"));
- assertEquals("OOSeven", StringUtils.getLettersOnly("OOSeven"));
- }
-
- @Test
- public void testGetSpaces() {
- assertEquals("", StringUtils.getSpaces(0));
- assertEquals(" ", StringUtils.getSpaces(1));
- assertEquals(" ", StringUtils.getSpaces(2));
- assertEquals(" ", StringUtils.getSpaces(3));
- assertEquals(" ", StringUtils.getSpaces(4));
- assertEquals(" ", StringUtils.getSpaces(5));
- assertEquals(" ", StringUtils.getSpaces(6));
- assertEquals(" ", StringUtils.getSpaces(7));
- assertEquals(" ", StringUtils.getSpaces(8));
- assertEquals(" ", StringUtils.getSpaces(9));
- assertEquals(" ", StringUtils.getSpaces(10));
- assertEquals(" ", StringUtils.getSpaces(11));
- assertEquals(" ", StringUtils.getSpaces(12));
- assertEquals(" ", StringUtils.getSpaces(13));
- assertEquals(" ", StringUtils.getSpaces(14));
- assertEquals(" ", StringUtils.getSpaces(15));
- assertEquals(" ", StringUtils.getSpaces(16));
- assertEquals(" ", StringUtils.getSpaces(17));
- assertEquals(" ", StringUtils.getSpaces(18));
- assertEquals(" ", StringUtils.getSpaces(19));
- assertEquals(" ", StringUtils.getSpaces(20));
- assertEquals(" ", StringUtils.getSpaces(21));
- }
-
- @Test
- public void testIsBlank() {
- assertTrue(StringUtils.isBlank(null));
- assertTrue(StringUtils.isBlank(""));
- assertTrue(StringUtils.isBlank("\0"));
- assertTrue(StringUtils.isBlank(" "));
- assertTrue(StringUtils.isBlank(" "));
- }
-
- @Test
- public void testIsNotBlank() {
- assertFalse(StringUtils.isBlank("test"));
- assertFalse(StringUtils.isBlank("null"));
- assertFalse(StringUtils.isBlank("empty"));
- assertFalse(StringUtils.isBlank("_"));
- assertFalse(StringUtils.isBlank("____"));
- }
-
- @Test
- public void testIsEmpty() {
- assertTrue(StringUtils.isEmpty(""));
- }
-
- @Test
- public void testIsNotEmpty() {
- assertFalse(StringUtils.isEmpty("test"));
- assertFalse(StringUtils.isEmpty("null"));
- assertFalse(StringUtils.isEmpty("empty"));
- assertFalse(StringUtils.isEmpty(null));
- assertFalse(StringUtils.isEmpty(" "));
- assertFalse(StringUtils.isEmpty(" "));
- assertFalse(StringUtils.isEmpty("_"));
- assertFalse(StringUtils.isEmpty("___"));
- }
- @Test
- public void testPadEnding() {
- assertEquals("", StringUtils.padEnding("", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 1));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 0));
- assertEquals(" ", StringUtils.padEnding(" ", 'X', 3));
- assertEquals("X", StringUtils.padEnding("", 'X', 1));
- assertEquals(" X", StringUtils.padEnding(" ", 'X', 2));
- assertEquals(" XX", StringUtils.padEnding(" ", 'X', 4));
- assertEquals("test", StringUtils.padEnding("test", 'X', 0));
- assertEquals("test", StringUtils.padEnding("test", 'X', 4));
- assertEquals("testX", StringUtils.padEnding("test", 'X', 5));
- assertEquals("testXXX", StringUtils.padEnding("test", 'X', 7));
- }
-
- @Test(expected = NullPointerException.class)
- public void testPadEndingWithNull() {
- try {
- StringUtils.padEnding(null, 'X', 10);
- } catch (NullPointerException expected) {
- assertEquals("The String value to pad cannot be null!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testToLowerCase() {
- assertNull(StringUtils.toLowerCase(null));
- assertEquals("null", StringUtils.toLowerCase("null"));
- assertEquals("null", StringUtils.toLowerCase("NULL"));
- assertEquals("", StringUtils.toLowerCase(""));
- assertEquals(" ", StringUtils.toLowerCase(" "));
- assertEquals("test", StringUtils.toLowerCase("TEST"));
- assertEquals("1", StringUtils.toLowerCase("1"));
- assertEquals("!", StringUtils.toLowerCase("!"));
- assertEquals("$00", StringUtils.toLowerCase("$00"));
- assertEquals("jon doe", StringUtils.toLowerCase("Jon Doe"));
- }
-
- @Test
- public void testToUpperCase() {
- assertNull(StringUtils.toUpperCase(null));
- assertEquals("NULL", StringUtils.toUpperCase("NULL"));
- assertEquals("NULL", StringUtils.toUpperCase("null"));
- assertEquals("", StringUtils.toUpperCase(""));
- assertEquals(" ", StringUtils.toUpperCase(" "));
- assertEquals("TEST", StringUtils.toUpperCase("test"));
- assertEquals("2", StringUtils.toUpperCase("2"));
- assertEquals("!", StringUtils.toUpperCase("!"));
- assertEquals("$00", StringUtils.toUpperCase("$00"));
- assertEquals("JON DOE", StringUtils.toUpperCase("Jon Doe"));
- }
-
- @Test
- public void testTrim() {
- assertNull(StringUtils.trim(null));
- assertEquals("", StringUtils.trim(""));
- assertEquals("", StringUtils.trim(" "));
- assertEquals("", StringUtils.trim(" "));
- assertEquals("null", StringUtils.trim("null"));
- assertEquals("test", StringUtils.trim(" test"));
- assertEquals("test", StringUtils.trim("test "));
- assertEquals("test", StringUtils.trim(" test "));
- assertEquals("a b c d", StringUtils.trim(" a b c d "));
- }
-
- @Test
- public void testTruncate() {
- assertEquals("", StringUtils.truncate("", 0));
- assertEquals("", StringUtils.truncate("", 1));
- assertEquals(" ", StringUtils.truncate(" ", 1));
- assertEquals(" ", StringUtils.truncate(" ", 5));
- assertEquals(" ", StringUtils.truncate(" ", 1));
- assertEquals("XX", StringUtils.truncate("XXX", 2));
- assertEquals("XX", StringUtils.truncate("XX", 4));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testTruncateWithNegativeLength() {
- try {
- StringUtils.truncate("XX", -1);
- } catch (IllegalArgumentException expected) {
- assertEquals("Length must be greater than equal to 0!", expected.getMessage());
- throw expected;
- }
- }
-
- @Test
- public void testValueOf() {
- assertEquals("null", StringUtils.valueOf(null));
- assertEquals("null", StringUtils.valueOf(null, (String[]) null));
- assertEquals("null", StringUtils.valueOf(null, new String[] {}));
- assertEquals("test", StringUtils.valueOf(null, "test"));
- assertEquals("nil", StringUtils.valueOf(null, "nil", "test"));
- assertEquals("test", StringUtils.valueOf("test", (String[]) null));
- assertEquals("null", StringUtils.valueOf("null", "test"));
- assertEquals("nil", StringUtils.valueOf("nil", "mock", "test"));
- assertEquals("", StringUtils.valueOf("", "test", "mock", "null"));
- assertEquals(" ", StringUtils.valueOf(" ", "test", "mock", "nil"));
- assertEquals("true", StringUtils.valueOf(true, "test", "nil", null));
- assertEquals("1", StringUtils.valueOf(1, "one"));
- assertEquals(String.valueOf(Math.PI), StringUtils.valueOf(Math.PI, "314159"));
- }
@Test
public void testWrap() {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
index 36be8b8..c760597 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/util/CollectionUtilsJUnitTest.java
@@ -14,7 +14,19 @@
*/
package org.apache.geode.internal.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import java.util.ArrayList;
import java.util.Arrays;
@@ -26,18 +38,11 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Vector;
import java.util.Map.Entry;
+import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Set;
-
-import org.apache.geode.internal.lang.Filter;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import java.util.Vector;
/**
* The CollectionUtilsJUnitTest class is a test suite of test cases testing the contract and
@@ -105,7 +110,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testCreateMultipleProperties() {
- Map<String, String> map = new HashMap<String, String>(3);
+ Map<String, String> map = new HashMap<>(3);
map.put("one", "A");
map.put("two", "B");
@@ -141,7 +146,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptyListWithEmptyList() {
- final List<Object> expectedList = new ArrayList<Object>(0);
+ final List<Object> expectedList = new ArrayList<>(0);
assertNotNull(expectedList);
assertTrue(expectedList.isEmpty());
@@ -174,7 +179,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptySetWithEmptySet() {
- final Set<Object> expectedSet = new HashSet<Object>(0);
+ final Set<Object> expectedSet = new HashSet<>(0);
assertNotNull(expectedSet);
assertTrue(expectedSet.isEmpty());
@@ -187,7 +192,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testEmptySetWithSet() {
final Set<String> expectedSet =
- new HashSet<String>(Arrays.asList("aardvark", "baboon", "cat", "dog", "ferret"));
+ new HashSet<>(Arrays.asList("aardvark", "baboon", "cat", "dog", "ferret"));
assertNotNull(expectedSet);
assertFalse(expectedSet.isEmpty());
@@ -201,12 +206,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAll() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept all even numbers
- public boolean accept(final Integer number) {
- return (number % 2 == 0);
- }
- });
+ // accept all even numbers
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number % 2 == 0));
assertNotNull(matches);
assertFalse(matches.isEmpty());
@@ -217,12 +218,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAllWhenMultipleElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 1, 4, 1, 6, 1, 7, 1, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept 1
- public boolean accept(final Integer number) {
- return (number == 1);
- }
- });
+ // accept 1
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number == 1));
assertNotNull(matches);
assertEquals(5, matches.size());
@@ -233,12 +230,8 @@ public class CollectionUtilsJUnitTest {
public void testFindAllWhenNoElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- final List<Integer> matches = CollectionUtils.findAll(numbers, new Filter<Integer>() {
- // accept negative numbers
- public boolean accept(final Integer number) {
- return (number < 0);
- }
- });
+ // accept negative numbers
+ final List<Integer> matches = CollectionUtils.findAll(numbers, number -> (number < 0));
assertNotNull(matches);
assertTrue(matches.isEmpty());
@@ -248,12 +241,8 @@ public class CollectionUtilsJUnitTest {
public void testFindBy() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 2
- public boolean accept(final Integer number) {
- return (number == 2);
- }
- });
+ // accept 2
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 2));
assertNotNull(match);
assertEquals(2, match.intValue());
@@ -263,12 +252,8 @@ public class CollectionUtilsJUnitTest {
public void testFindByWhenMultipleElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 1, 4, 1, 6, 1, 7, 1, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 1
- public boolean accept(final Integer number) {
- return (number == 1);
- }
- });
+ // accept 1
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 1));
assertNotNull(match);
assertEquals(1, match.intValue());
@@ -278,19 +263,15 @@ public class CollectionUtilsJUnitTest {
public void testFindByWhenNoElementsMatch() {
final List<Integer> numbers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9);
- final Integer match = CollectionUtils.findBy(numbers, new Filter<Integer>() {
- // accept 10
- public boolean accept(final Integer number) {
- return (number == 10);
- }
- });
+ // accept 10
+ final Integer match = CollectionUtils.findBy(numbers, number -> (number == 10));
assertNull(match);
}
@Test
public void testRemoveKeys() {
- final Map<Object, String> expectedMap = new HashMap<Object, String>(6);
+ final Map<Object, String> expectedMap = new HashMap<>(6);
expectedMap.put("key1", "value");
expectedMap.put("key2", "null");
@@ -303,12 +284,7 @@ public class CollectionUtilsJUnitTest {
assertEquals(6, expectedMap.size());
final Map<Object, String> actualMap =
- CollectionUtils.removeKeys(expectedMap, new Filter<Map.Entry<Object, String>>() {
- @Override
- public boolean accept(final Map.Entry<Object, String> entry) {
- return !StringUtils.isBlank(entry.getValue());
- }
- });
+ CollectionUtils.removeKeys(expectedMap, entry -> StringUtils.isNotBlank(entry.getValue()));
assertSame(expectedMap, actualMap);
assertFalse(actualMap.isEmpty());
@@ -318,7 +294,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testRemoveKeysWithNullValues() {
- final Map<Object, Object> expectedMap = new HashMap<Object, Object>(3);
+ final Map<Object, Object> expectedMap = new HashMap<>(3);
expectedMap.put("one", "test");
expectedMap.put("two", null);
@@ -350,7 +326,7 @@ public class CollectionUtilsJUnitTest {
@Test
public void testRemoveKeysWithNullValuesFromMapWithNoNullValues() {
- final Map<String, Object> map = new HashMap<String, Object>(5);
+ final Map<String, Object> map = new HashMap<>(5);
map.put("one", "test");
map.put("null", "null");
@@ -430,7 +406,7 @@ public class CollectionUtilsJUnitTest {
list.add("one");
list.add("two");
- boolean modified = CollectionUtils.addAll(list, (Enumeration<String>) null);
+ boolean modified = CollectionUtils.addAll(list, null);
assertTrue(!modified);
assertEquals(2, list.size());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
index 91a59f8..7fedb9f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupportJUnitTest.java
@@ -14,21 +14,12 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static org.junit.Assert.*;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collections;
-import java.util.Set;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionService;
@@ -41,6 +32,19 @@ import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.concurrent.Synchroniser;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.Set;
/**
* The AbstractCommandsSupportJUnitTest class is a test suite of test cases testing the contract and
@@ -140,9 +144,9 @@ public class AbstractCommandsSupportJUnitTest {
@Test
public void testConvertDefaultValue() {
- assertNull(AbstractCommandsSupport.convertDefaultValue(null, StringUtils.EMPTY_STRING));
- assertEquals(StringUtils.EMPTY_STRING,
- AbstractCommandsSupport.convertDefaultValue(StringUtils.EMPTY_STRING, "test"));
+ assertNull(AbstractCommandsSupport.convertDefaultValue(null, StringUtils.EMPTY));
+ assertEquals(StringUtils.EMPTY,
+ AbstractCommandsSupport.convertDefaultValue(StringUtils.EMPTY, "test"));
assertEquals(StringUtils.SPACE,
AbstractCommandsSupport.convertDefaultValue(StringUtils.SPACE, "testing"));
assertEquals("tested", AbstractCommandsSupport
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index 8bf1c43..5ff0a67 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -14,14 +14,27 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import org.apache.geode.cache.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.geode.test.dunit.Assert.assertNotNull;
+import static org.apache.geode.test.dunit.Assert.assertSame;
+import static org.apache.geode.test.dunit.Assert.assertTrue;
+import static org.apache.geode.test.dunit.LogWriterUtils.getDUnitLogLevel;
+import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.query.Index;
import org.apache.geode.cache.query.IndexStatistics;
import org.apache.geode.cache.query.IndexType;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.internal.lang.MutableIdentifiable;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.domain.IndexDetails;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -34,15 +47,17 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
-import static org.apache.geode.test.dunit.Assert.*;
-import static org.apache.geode.test.dunit.LogWriterUtils.getDUnitLogLevel;
-import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* The ListIndexCommandDUnitTest class is distributed test suite of test cases for testing the
* index-based GemFire shell (Gfsh) commands.
@@ -57,7 +72,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private static final int DEFAULT_REGION_INITIAL_CAPACITY = 10000;
- private final AtomicLong idGenerator = new AtomicLong(0l);
+ private final AtomicLong idGenerator = new AtomicLong(0L);
@Override
public final void postSetUpCliCommandTestBase() throws Exception {
@@ -186,7 +201,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
final Random random = new Random(System.currentTimeMillis());
int count = 0;
- final List<Proxy> proxies = new ArrayList<Proxy>();
+ final List<Proxy> proxies = new ArrayList<>();
Consumer consumer;
Proxy proxy;
@@ -232,7 +247,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
final Random random = new Random(System.currentTimeMillis());
int count = 0;
- final List<Proxy> proxies = new ArrayList<Proxy>();
+ final List<Proxy> proxies = new ArrayList<>();
Producer producer;
Proxy proxy;
@@ -322,7 +337,7 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private final Properties distributedSystemProperties;
- private final Set<RegionDefinition> regions = new HashSet<RegionDefinition>();
+ private final Set<RegionDefinition> regions = new HashSet<>();
private final VM vm;
@@ -471,14 +486,14 @@ public class ListIndexCommandDUnitTest extends CliCommandTestBase {
private final Class<?> keyConstraint;
private final Class<?> valueConstraint;
- private final Set<Index> indexes = new HashSet<Index>();
+ private final Set<Index> indexes = new HashSet<>();
private final String regionName;
@SuppressWarnings("unchecked")
protected RegionDefinition(final String regionName, final Class<?> keyConstraint,
final Class<?> valueConstraint) {
- assert !StringUtils.isBlank(regionName) : "The name of the Region must be specified!";
+ assert StringUtils.isNotBlank(regionName) : "The name of the Region must be specified!";
this.regionName = regionName;
this.keyConstraint = ObjectUtils.defaultIfNull(keyConstraint, Object.class);
this.valueConstraint = ObjectUtils.defaultIfNull(valueConstraint, Object.class);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
index fc920c4..cea77fa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
@@ -21,14 +21,13 @@ import static java.util.stream.Collectors.toSet;
import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE_SIZE_LIMIT;
import static org.assertj.core.api.Assertions.assertThat;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.DeployedJar;
-import org.apache.geode.internal.JarDeployer;
import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.configuration.domain.Configuration;
import org.apache.geode.test.dunit.rules.Locator;
import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
@@ -41,7 +40,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -93,7 +91,7 @@ public class ClusterConfig implements Serializable {
Set<String> expectedGroupConfigs =
this.getGroups().stream().map(ConfigGroup::getName).collect(toSet());
- // verify info exists in memeory
+ // verify info exists in memory
locatorVM.invoke(() -> {
InternalLocator internalLocator = LocatorServerStartupRule.locatorStarter.getLocator();
ClusterConfigurationService sc = internalLocator.getSharedConfiguration();
@@ -107,8 +105,8 @@ public class ClusterConfig implements Serializable {
Configuration config = sc.getConfiguration(configGroup.name);
assertThat(config.getJarNames()).isEqualTo(configGroup.getJars());
- // verify proeprty is as expected
- if (!StringUtils.isBlank(configGroup.getMaxLogFileSize())) {
+ // verify property is as expected
+ if (StringUtils.isNotBlank(configGroup.getMaxLogFileSize())) {
Properties props = config.getGemfireProperties();
assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT))
.isEqualTo(configGroup.getMaxLogFileSize());
@@ -135,7 +133,7 @@ public class ClusterConfig implements Serializable {
}
}
- public void verifyServer(MemberVM<Server> serverVM) throws ClassNotFoundException {
+ public void verifyServer(MemberVM<Server> serverVM) {
// verify files exist in filesystem
Set<String> expectedJarNames = this.getJarNames().stream().collect(toSet());
@@ -156,7 +154,7 @@ public class ClusterConfig implements Serializable {
assertThat(cache.getRegion(region)).isNotNull();
}
- if (!StringUtils.isBlank(this.getMaxLogFileSize())) {
+ if (StringUtils.isNotBlank(this.getMaxLogFileSize())) {
Properties props = cache.getDistributedSystem().getProperties();
assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT)).isEqualTo(this.getMaxLogFileSize());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 19a1662..bc709db 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -17,7 +17,7 @@ package org.apache.geode.test.dunit.rules;
import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
import static org.assertj.core.api.Assertions.assertThat;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.cli.HeadlessGfsh;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index b2be12a..033fedc 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.cache.lucene.internal.cli;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.Execution;
@@ -28,7 +29,6 @@ import org.apache.geode.cache.lucene.internal.cli.functions.LuceneSearchIndexFun
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.execute.AbstractExecution;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.IntegratedSecurityService;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.cli.CliMetaData;
@@ -82,11 +82,10 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_LIST_INDEX,
help = LuceneCliStrings.LUCENE_LIST_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result listIndex(@CliOption(key = LuceneCliStrings.LUCENE_LIST_INDEX__STATS,
- mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
+ specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = LuceneCliStrings.LUCENE_LIST_INDEX__STATS__HELP) final boolean stats) {
try {
@@ -120,7 +119,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
List<LuceneIndexDetails> sortedResults =
results.stream().flatMap(set -> set.stream()).sorted().collect(Collectors.toList());
- LinkedHashSet<LuceneIndexDetails> uniqResults = new LinkedHashSet<LuceneIndexDetails>();
+ LinkedHashSet<LuceneIndexDetails> uniqResults = new LinkedHashSet<>();
uniqResults.addAll(sortedResults);
sortedResults.clear();
sortedResults.addAll(uniqResults);
@@ -137,10 +136,9 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
indexData.accumulate("Server Name", indexDetails.getServerName());
indexData.accumulate("Indexed Fields", indexDetails.getSearchableFieldNamesString());
indexData.accumulate("Field Analyzer", indexDetails.getFieldAnalyzersString());
- indexData.accumulate("Status",
- indexDetails.getInitialized() == true ? "Initialized" : "Defined");
+ indexData.accumulate("Status", indexDetails.getInitialized() ? "Initialized" : "Defined");
- if (stats == true) {
+ if (stats) {
if (!indexDetails.getInitialized()) {
indexData.accumulate("Query Executions", "NA");
indexData.accumulate("Updates", "NA");
@@ -164,8 +162,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_CREATE_INDEX,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
// TODO : Add optionContext for indexName
public Result createIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__NAME__HELP) final String indexName,
@@ -177,11 +174,10 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD, mandatory = true,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD_HELP) final String[] fields,
- @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER,
help = LuceneCliStrings.LUCENE_CREATE_INDEX__ANALYZER_HELP) final String[] analyzers) {
- Result result = null;
+ Result result;
XmlEntity xmlEntity = null;
this.securityService.authorizeRegionManage(regionPath);
@@ -222,8 +218,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_DESCRIBE_INDEX,
help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result describeIndex(
@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
@@ -262,8 +257,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_SEARCH_INDEX,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
@ResourceOperation(resource = Resource.DATA, operation = Operation.WRITE)
public Result searchIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = true,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__NAME__HELP) final String indexName,
@@ -278,15 +272,14 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, mandatory = true,
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD__HELP) final String defaultField,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT, mandatory = false,
- unspecifiedDefaultValue = "-1",
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT, unspecifiedDefaultValue = "-1",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__LIMIT__HELP) final int limit,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE, mandatory = false,
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE,
unspecifiedDefaultValue = "-1",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__PAGE_SIZE__HELP) int pageSize,
- @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY, mandatory = false,
+ @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY,
unspecifiedDefaultValue = "false",
help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly) {
try {
@@ -315,11 +308,9 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
@CliCommand(value = LuceneCliStrings.LUCENE_DESTROY_INDEX,
help = LuceneCliStrings.LUCENE_DESTROY_INDEX__HELP)
- @CliMetaData(shellOnly = false,
- relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
- public Result destroyIndex(
- @CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME, mandatory = false,
- help = LuceneCliStrings.LUCENE_DESTROY_INDEX__NAME__HELP) final String indexName,
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_REGION, CliStrings.TOPIC_GEODE_DATA})
+ public Result destroyIndex(@CliOption(key = LuceneCliStrings.LUCENE__INDEX_NAME,
+ help = LuceneCliStrings.LUCENE_DESTROY_INDEX__NAME__HELP) final String indexName,
@CliOption(key = LuceneCliStrings.LUCENE__REGION_PATH, mandatory = true,
optionContext = ConverterHint.REGION_PATH,
@@ -329,7 +320,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
CliStrings.format(LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__REGION_CANNOT_BE_EMPTY));
}
- if (StringUtils.isEmpty(indexName)) {
+ if (indexName != null && StringUtils.isEmpty(indexName)) {
return ResultBuilder.createInfoResult(
CliStrings.format(LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__INDEX_CANNOT_BE_EMPTY));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
index f7edd8f..a5ec7d5 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneCreateIndexFunction.java
@@ -15,6 +15,7 @@
package org.apache.geode.cache.lucene.internal.cli.functions;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.FunctionAdapter;
@@ -26,12 +27,10 @@ import org.apache.geode.cache.lucene.internal.cli.LuceneCliStrings;
import org.apache.geode.cache.lucene.internal.cli.LuceneIndexDetails;
import org.apache.geode.cache.lucene.internal.cli.LuceneIndexInfo;
import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index d4dca4a..143e99d 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -14,32 +14,18 @@
*/
package org.apache.geode.cache.lucene.internal.cli;
-import static org.junit.Assert.*;
+import static junit.framework.TestCase.assertSame;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.ResultCollector;
@@ -60,6 +46,25 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.core.KeywordAnalyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
/**
* The LuceneIndexCommandsJUnitTest class is a test suite of test cases testing the contract and
@@ -409,7 +414,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEX_0_FROM_REGION_1,
@@ -446,7 +451,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEX_0_FROM_REGION_1,
@@ -478,7 +483,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEXES_FROM_REGION_0,
@@ -515,7 +520,7 @@ public class LuceneIndexCommandsJUnitTest {
final ResultCollector mockResultCollector = mock(ResultCollector.class);
final List<CliFunctionResult> cliFunctionResults = new ArrayList<>();
- String expectedStatus = null;
+ String expectedStatus;
if (expectedToSucceed) {
expectedStatus = CliStrings.format(
LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__SUCCESSFULLY_DESTROYED_INDEXES_FROM_REGION_0,
@@ -564,8 +569,8 @@ public class LuceneIndexCommandsJUnitTest {
}
// Verify each status
List<String> status = data.retrieveAllValues("Status");
- for (int i = 0; i < status.size(); i++) {
- assertEquals(expectedStatus, status.get(i));
+ for (String statu : status) {
+ assertEquals(expectedStatus, statu);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
index 6ee5b53..7ce9c46 100644
--- a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/testbed/PropMockDataUpdater.java
@@ -34,7 +34,6 @@ import org.apache.geode.tools.pulse.testbed.GemFireDistributedSystem.Server;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -57,7 +56,7 @@ public class PropMockDataUpdater implements IClusterUpdater {
private Cluster cluster = null;
private TestBed testbed;
- private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");;
+ private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");
private final ObjectMapper mapper = new ObjectMapper();
@@ -65,14 +64,12 @@ public class PropMockDataUpdater implements IClusterUpdater {
this.cluster = cluster;
try {
loadPropertiesFile();
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
- private void loadPropertiesFile() throws FileNotFoundException, IOException {
+ private void loadPropertiesFile() throws IOException {
this.testbed = new TestBed(testbedFile, true);
}
@@ -161,8 +158,8 @@ public class PropMockDataUpdater implements IClusterUpdater {
}
for (Entry<String, Member> memberSet : membersHMap.entrySet()) {
- HashMap<String, Cluster.Region> memberRegions = new HashMap<String, Cluster.Region>();
- HashMap<String, Cluster.Client> memberClientsHM = new HashMap<String, Cluster.Client>();
+ HashMap<String, Cluster.Region> memberRegions = new HashMap<>();
+ HashMap<String, Cluster.Client> memberClientsHM = new HashMap<>();
Random randomGenerator = new Random();
@@ -277,10 +274,6 @@ public class PropMockDataUpdater implements IClusterUpdater {
memberRegion.setWanEnabled(false);
}
memberRegion.setWanEnabled(true);
- /*
- * memberRegion.setSystemRegionEntryCount(Long.valueOf(String.valueOf(Math
- * .abs(randomGenerator.nextInt(100)))));
- */
memberRegion.getMemberName().add(memName);
memberRegion.setMemberCount(memberCount);
return memberRegion;
@@ -369,7 +362,7 @@ public class PropMockDataUpdater implements IClusterUpdater {
if (memberArrList != null) {
memberArrList.add(m);
} else {
- ArrayList<Cluster.Member> memberList = new ArrayList<Cluster.Member>();
+ ArrayList<Cluster.Member> memberList = new ArrayList<>();
memberList.add(m);
physicalToMember.put(m.getHost(), memberList);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
index 096e4d5..7407cc8 100644
--- a/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
+++ b/geode-spark-connector/geode-functions/src/main/java/org/apache/geode/spark/connector/internal/geodefunctions/RetrieveRegionFunction.java
@@ -16,25 +16,24 @@
*/
package org.apache.geode.spark.connector.internal.geodefunctions;
-import java.util.Iterator;
-import org.apache.logging.log4j.Logger;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.FunctionException;
+import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.cache.query.Query;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.SelectResults;
import org.apache.geode.cache.query.Struct;
-import org.apache.geode.internal.cache.*;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.internal.cache.execute.InternalRegionFunctionContext;
import org.apache.geode.internal.cache.execute.InternalResultSender;
import org.apache.geode.internal.cache.partitioned.PREntriesIterator;
import org.apache.geode.internal.logging.LogService;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Iterator;
/**
* GemFire function that is used by `SparkContext.geodeRegion(regionPath, whereClause)`
@@ -85,10 +84,11 @@ public class RetrieveRegionFunction implements Function {
InternalRegionFunctionContext irfc = (InternalRegionFunctionContext) context;
LocalRegion localRegion = (LocalRegion) irfc.getDataSet();
boolean partitioned = localRegion.getDataPolicy().withPartitioning();
- if (where.trim().isEmpty())
+ if (StringUtils.isBlank(where)) {
retrieveFullRegion(irfc, partitioned, taskDesc);
- else
+ } else {
retrieveRegionWithWhereClause(irfc, localRegion, partitioned, where, taskDesc);
+ }
}
/** ------------------------------------------ */
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
index eac0b8d..73be12a 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/AbstractWebTestCase.java
@@ -14,6 +14,9 @@
*/
package org.apache.geode.management.internal.web;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.internal.web.domain.Link;
+
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -22,9 +25,6 @@ import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.web.domain.Link;
-
/**
* The AbstractWebDomainTests class is abstract base class containing functionality common to a test
* suite classes in the org.apache.geode.management.internal.web.domain package.
@@ -48,7 +48,7 @@ public abstract class AbstractWebTestCase {
assert values != null : "The Values for the Map cannot be null!";
assert keys.length == values.length;
- final Map<K, V> map = new HashMap<K, V>(keys.length);
+ final Map<K, V> map = new HashMap<>(keys.length);
int index = 0;
for (final K key : keys) {
@@ -59,11 +59,11 @@ public abstract class AbstractWebTestCase {
}
protected String decode(final String encodedValue) throws UnsupportedEncodingException {
- return URLDecoder.decode(encodedValue, StringUtils.UTF_8);
+ return URLDecoder.decode(encodedValue, "UTF-8");
}
protected String encode(final String value) throws UnsupportedEncodingException {
- return URLEncoder.encode(value, StringUtils.UTF_8);
+ return URLEncoder.encode(value, "UTF-8");
}
protected String toString(final Link... links) throws UnsupportedEncodingException {
@@ -71,7 +71,7 @@ public abstract class AbstractWebTestCase {
int count = 0;
for (final Link link : links) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(toString(link));
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(toString(link));
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
index 37ec508..10e26f6 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/ShellCommandsControllerJUnitTest.java
@@ -14,17 +14,18 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.internal.cli.util.ClasspathScanLoadHelper;
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.management.internal.web.domain.LinkIndex;
+import org.apache.geode.management.internal.web.util.UriUtils;
+import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -37,12 +38,14 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.internal.cli.util.ClasspathScanLoadHelper;
-import org.apache.geode.management.internal.web.domain.Link;
-import org.apache.geode.management.internal.web.domain.LinkIndex;
-import org.apache.geode.management.internal.web.util.UriUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
/**
* The ShellCommandsControllerJUnitTest class is a test suite of test cases testing the contract and
@@ -123,8 +126,7 @@ public class ShellCommandsControllerJUnitTest {
String[] requestParameters = requestMappingAnnotation.params();
if (requestParameters.length > 0) {
- webServiceEndpoint += "?".concat(
- org.apache.geode.internal.lang.StringUtils.concat(requestParameters, "&"));
+ webServiceEndpoint += "?".concat(StringUtils.join(requestParameters, "&"));
}
controllerWebServiceEndpoints.add(webServiceEndpoint);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
index c69013b..2bebd2e 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvokerJUnitTest.java
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.management.internal.cli.CommandRequest;
import org.apache.geode.management.internal.web.AbstractWebTestCase;
import org.apache.geode.management.internal.web.domain.Link;
@@ -112,7 +112,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private CommandRequest createCommandRequest(final String command,
final Map<String, String> options) {
- return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(), null);
+ return new TestCommandRequest(command, options, Collections.emptyMap(), null);
}
private CommandRequest createCommandRequest(final String command,
@@ -122,8 +122,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private CommandRequest createCommandRequest(final String command,
final Map<String, String> options, final byte[][] fileData) {
- return new TestCommandRequest(command, options, Collections.<String, String>emptyMap(),
- fileData);
+ return new TestCommandRequest(command, options, Collections.emptyMap(), fileData);
}
private CommandRequest createCommandRequest(final String command,
@@ -145,12 +144,12 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testCreateHttpRequest() {
- final Map<String, String> commandOptions = new HashMap<String, String>();
+ final Map<String, String> commandOptions = new HashMap<>();
commandOptions.put("author", "Adams");
commandOptions.put("blankOption", " ");
commandOptions.put("category", "sci-fi");
- commandOptions.put("emptyOption", StringUtils.EMPTY_STRING);
+ commandOptions.put("emptyOption", StringUtils.EMPTY);
commandOptions.put("isbn", "0-123456789");
commandOptions.put("nullOption", null);
commandOptions.put("title", "Hitch Hiker's Guide to the Galaxy");
@@ -182,12 +181,12 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testCreateHttpRequestWithEnvironmentVariables() {
- final Map<String, String> commandOptions = new HashMap<String, String>(2);
+ final Map<String, String> commandOptions = new HashMap<>(2);
commandOptions.put("name", "ElLibreDeCongress");
commandOptions.put("isbn", "${ISBN}");
- final Map<String, String> environment = new HashMap<String, String>(2);
+ final Map<String, String> environment = new HashMap<>(2);
environment.put("ISBN", "0-987654321");
environment.put("VAR", "test");
@@ -209,7 +208,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
}
@Test
- public void testCreatHttpRequestWithFileData() {
+ public void testCreateHttpRequestWithFileData() {
final Map<String, String> commandOptions = Collections.singletonMap("isbn", "0-123456789");
final byte[][] fileData = {"/path/to/book/content.txt".getBytes(),
@@ -238,7 +237,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
@Test
public void testFindAndResolveLink() throws Exception {
- final Map<String, String> commandOptions = new HashMap<String, String>();
+ final Map<String, String> commandOptions = new HashMap<>();
commandOptions.put("name", "BarnesN'Noble");
@@ -253,7 +252,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
assertNotNull(link);
assertEquals("http://host.domain.com/service/v1/libraries/{name}", toString(link.getHref()));
- commandOptions.put("author", "J.K.Rowlings");
+ commandOptions.put("author", "J.K.Rowling");
link = getOperationInvoker().findLink(createCommandRequest("list-books", commandOptions));
@@ -323,8 +322,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
}
};
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("list-libraries", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("list-libraries", Collections.emptyMap()));
assertEquals(expectedResult, actualResult);
}
@@ -353,8 +352,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
protected void printWarning(final String message, final Object... args) {}
};
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("get resource", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("get resource", Collections.emptyMap()));
assertEquals(expectedResult, actualResult);
}
@@ -391,8 +390,8 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
+ "Please try reconnecting or see the GemFire Manager's log file for further details.",
operationInvoker.getBaseUrl(), "test");
- final Object actualResult = operationInvoker.processCommand(
- createCommandRequest("list-libraries", Collections.<String, String>emptyMap()));
+ final Object actualResult = operationInvoker
+ .processCommand(createCommandRequest("list-libraries", Collections.emptyMap()));
assertFalse(operationInvoker.isConnected());
assertEquals(expectedResult, actualResult);
@@ -413,8 +412,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
};
try {
- operationInvoker.processCommand(
- createCommandRequest("get resource", Collections.<String, String>emptyMap()));
+ operationInvoker.processCommand(createCommandRequest("get resource", Collections.emptyMap()));
} catch (RestApiCallForCommandNotFoundException e) {
assertEquals("No REST API call for command (get resource) was found!", e.getMessage());
throw e;
@@ -425,7 +423,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
public void testProcessCommandWhenNotConnected() {
try {
getOperationInvoker()
- .processCommand(createCommandRequest("get-book", Collections.<String, String>emptyMap()));
+ .processCommand(createCommandRequest("get-book", Collections.emptyMap()));
} catch (IllegalStateException e) {
assertEquals(
"Gfsh must be connected to the GemFire Manager in order to process commands remotely!",
@@ -436,7 +434,7 @@ public class RestHttpOperationInvokerJUnitTest extends AbstractWebTestCase {
private static class TestCommandRequest extends CommandRequest {
- private final Map<String, String> commandParameters = new TreeMap<String, String>();
+ private final Map<String, String> commandParameters = new TreeMap<>();
private final String command;
[26/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
index 9ed00be..f09c854 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommand.java
@@ -23,21 +23,20 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.regex.Pattern;
+import edu.umd.cs.findbugs.annotations.SuppressWarnings;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.CancelException;
import org.apache.geode.CopyException;
import org.apache.geode.InternalGemFireError;
import org.apache.geode.SerializationException;
import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheLoaderException;
import org.apache.geode.cache.CacheWriterException;
import org.apache.geode.cache.InterestResultPolicy;
@@ -86,24 +85,12 @@ import org.apache.geode.security.GemFireSecurityException;
public abstract class BaseCommand implements Command {
protected static final Logger logger = LogService.getLogger();
- /**
- * Whether zipped values are being passed to/from the client. Can be modified using the system
- * property Message.ZIP_VALUES ? This does not appear to happen anywhere
- */
- protected static final boolean zipValues = false;
-
- protected static final boolean APPLY_RETRIES =
- Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "gateway.ApplyRetries");
-
- public static final byte[] OK_BYTES = new byte[] {0};
-
- public static final int maximumChunkSize =
- Integer.getInteger("BridgeServer.MAXIMUM_CHUNK_SIZE", 100).intValue();
+ private static final byte[] OK_BYTES = new byte[] {0};
- /** Maximum number of entries in each chunked response chunk */
+ public static final int MAXIMUM_CHUNK_SIZE = Integer.getInteger("BridgeServer.MAXIMUM_CHUNK_SIZE", 100);
/** Whether to suppress logging of IOExceptions */
- private static boolean suppressIOExceptionLogging =
+ private static final boolean SUPPRESS_IO_EXCEPTION_LOGGING =
Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "bridge.suppressIOExceptionLogging");
/**
@@ -112,86 +99,88 @@ public abstract class BaseCommand implements Command {
* of them completes or fails. The bytes are computed based in the size sent in the incoming msg
* header.
*/
- private static final int MAX_INCOMING_DATA =
- Integer.getInteger("BridgeServer.MAX_INCOMING_DATA", -1).intValue();
+ private static final int MAX_INCOMING_DATA = Integer.getInteger("BridgeServer.MAX_INCOMING_DATA", -1);
/**
* Maximum number of concurrent incoming client messages that a bridge server will allow. Once a
* server is working on this number additional incoming client messages will wait until one of
* them completes or fails.
*/
- private static final int MAX_INCOMING_MSGS =
- Integer.getInteger("BridgeServer.MAX_INCOMING_MSGS", -1).intValue();
+ private static final int MAX_INCOMING_MESSAGES = Integer.getInteger("BridgeServer.MAX_INCOMING_MSGS", -1);
- private static final Semaphore incomingDataLimiter;
+ private static final Semaphore INCOMING_DATA_LIMITER;
+
+ private static final Semaphore INCOMING_MSG_LIMITER;
+
+ protected SecurityService securityService = IntegratedSecurityService.getSecurityService();
- private static final Semaphore incomingMsgLimiter;
static {
- Semaphore tmp;
+ Semaphore semaphore;
if (MAX_INCOMING_DATA > 0) {
// backport requires that this is fair since we inc by values > 1
- tmp = new Semaphore(MAX_INCOMING_DATA, true);
+ semaphore = new Semaphore(MAX_INCOMING_DATA, true);
} else {
- tmp = null;
+ semaphore = null;
}
- incomingDataLimiter = tmp;
- if (MAX_INCOMING_MSGS > 0) {
- tmp = new Semaphore(MAX_INCOMING_MSGS, false); // unfair for best
- // performance
+ INCOMING_DATA_LIMITER = semaphore;
+ if (MAX_INCOMING_MESSAGES > 0) {
+ // unfair for best performance
+ semaphore = new Semaphore(MAX_INCOMING_MESSAGES, false);
} else {
- tmp = null;
+ semaphore = null;
}
- incomingMsgLimiter = tmp;
-
+ INCOMING_MSG_LIMITER = semaphore;
}
- protected SecurityService securityService = IntegratedSecurityService.getSecurityService();
+ protected static byte[] okBytes() {
+ return OK_BYTES;
+ }
- public void execute(Message msg, ServerConnection servConn) {
+ @Override
+ public void execute(Message clientMessage, ServerConnection serverConnection) {
// Read the request and update the statistics
long start = DistributionStats.getStatTime();
- // servConn.resetTransientData();
- if (EntryLogger.isEnabled() && servConn != null) {
- EntryLogger.setSource(servConn.getMembershipID(), "c2s");
+ if (EntryLogger.isEnabled() && serverConnection != null) {
+ EntryLogger.setSource(serverConnection.getMembershipID(), "c2s");
}
- boolean shouldMasquerade = shouldMasqueradeForTx(msg, servConn);
+ boolean shouldMasquerade = shouldMasqueradeForTx(clientMessage, serverConnection);
try {
if (shouldMasquerade) {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
InternalDistributedMember member =
- (InternalDistributedMember) servConn.getProxyID().getDistributedMember();
+ (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember();
TXManagerImpl txMgr = cache.getTxManager();
TXStateProxy tx = null;
try {
- tx = txMgr.masqueradeAs(msg, member, false);
- cmdExecute(msg, servConn, start);
+ tx = txMgr.masqueradeAs(clientMessage, member, false);
+ cmdExecute(clientMessage, serverConnection, start);
tx.updateProxyServer(txMgr.getMemberId());
} finally {
txMgr.unmasquerade(tx);
}
} else {
- cmdExecute(msg, servConn, start);
+ cmdExecute(clientMessage, serverConnection, start);
}
} catch (TransactionException | CopyException | SerializationException | CacheWriterException
| CacheLoaderException | GemFireSecurityException | PartitionOfflineException
| MessageTooLargeException e) {
- handleExceptionNoDisconnect(msg, servConn, e);
+ handleExceptionNoDisconnect(clientMessage, serverConnection, e);
} catch (EOFException eof) {
- BaseCommand.handleEOFException(msg, servConn, eof);
+ BaseCommand.handleEOFException(clientMessage, serverConnection, eof);
} catch (InterruptedIOException e) { // Solaris only
- BaseCommand.handleInterruptedIOException(msg, servConn, e);
+ BaseCommand.handleInterruptedIOException(serverConnection, e);
} catch (IOException e) {
- BaseCommand.handleIOException(msg, servConn, e);
+ BaseCommand.handleIOException(clientMessage, serverConnection, e);
} catch (DistributedSystemDisconnectedException e) {
- BaseCommand.handleShutdownException(msg, servConn, e);
+ BaseCommand.handleShutdownException(clientMessage, serverConnection, e);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
} catch (Throwable e) {
- BaseCommand.handleThrowable(msg, servConn, e);
+ BaseCommand.handleThrowable(clientMessage, serverConnection, e);
} finally {
EntryLogger.clearSource();
}
@@ -201,16 +190,10 @@ public abstract class BaseCommand implements Command {
* checks to see if this thread needs to masquerade as a transactional thread. clients after
* GFE_66 should be able to start a transaction.
*
- * @param msg
- * @param servConn
* @return true if thread should masquerade as a transactional thread.
*/
- protected boolean shouldMasqueradeForTx(Message msg, ServerConnection servConn) {
- if (servConn.getClientVersion().compareTo(Version.GFE_66) >= 0
- && msg.getTransactionId() > TXManagerImpl.NOTX) {
- return true;
- }
- return false;
+ protected boolean shouldMasqueradeForTx(Message clientMessage, ServerConnection serverConnection) {
+ return serverConnection.getClientVersion().compareTo(Version.GFE_66) >= 0 && clientMessage.getTransactionId() > TXManagerImpl.NOTX;
}
/**
@@ -221,13 +204,11 @@ public abstract class BaseCommand implements Command {
* <p>
* The client event should have the event identifier from the client and the region affected by
* the operation.
- *
- * @param clientEvent
*/
public boolean recoverVersionTagForRetriedOperation(EntryEventImpl clientEvent) {
LocalRegion r = clientEvent.getRegion();
- VersionTag tag = null;
- if ((clientEvent.getVersionTag() != null) && (clientEvent.getVersionTag().isGatewayTag())) {
+ VersionTag tag;
+ if (clientEvent.getVersionTag() != null && clientEvent.getVersionTag().isGatewayTag()) {
tag = r.findVersionTagForGatewayEvent(clientEvent.getEventId());
} else {
tag = r.findVersionTagForClientEvent(clientEvent.getEventId());
@@ -246,7 +227,7 @@ public abstract class BaseCommand implements Command {
}
clientEvent.setVersionTag(tag);
}
- return (tag != null);
+ return tag != null;
}
/**
@@ -258,18 +239,18 @@ public abstract class BaseCommand implements Command {
* The client event should have the event identifier from the client and the region affected by
* the operation.
*/
- protected VersionTag findVersionTagsForRetriedBulkOp(LocalRegion r, EventID eventID) {
- VersionTag tag = r.findVersionTagForClientBulkOp(eventID);
+ protected VersionTag findVersionTagsForRetriedBulkOp(LocalRegion region, EventID eventID) {
+ VersionTag tag = region.findVersionTagForClientBulkOp(eventID);
if (tag != null) {
if (logger.isDebugEnabled()) {
logger.debug("recovered version tag {} for replayed bulk operation {}", tag, eventID);
}
return tag;
}
- if (r instanceof DistributedRegion || r instanceof PartitionedRegion) {
+ if (region instanceof DistributedRegion || region instanceof PartitionedRegion) {
// TODO this could be optimized for partitioned regions by sending the key
// so that the PR could look at an individual bucket for the event
- tag = FindVersionTagOperation.findVersionTag(r, eventID, true);
+ tag = FindVersionTagOperation.findVersionTag(region, eventID, true);
}
if (tag != null) {
if (logger.isDebugEnabled()) {
@@ -279,285 +260,231 @@ public abstract class BaseCommand implements Command {
return tag;
}
- abstract public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public abstract void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException;
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
- Message replyMsg = servConn.getReplyMessage();
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
+ Message replyMsg = serverConnection.getReplyMessage();
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(1);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
- replyMsg.send(servConn);
+ replyMsg.addBytesPart(okBytes());
+ replyMsg.send(serverConnection);
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl tx: {}", servConn.getName(), origMsg.getTransactionId());
+ logger.trace("{}: rpl tx: {}", serverConnection.getName(), origMsg.getTransactionId());
}
}
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
- Message replyMsg = servConn.getReplyMessage();
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
+ Message replyMsg = serverConnection.getReplyMessage();
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(1);
replyMsg.setTransactionId(origMsg.getTransactionId());
replyMsg.addBytesPart(new byte[] {pr.getMetadataVersion(), nwHop});
- replyMsg.send(servConn);
+ replyMsg.send(serverConnection);
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", serverConnection.getName(),
origMsg.getTransactionId());
}
}
- private static void handleEOFException(Message msg, ServerConnection servConn, Exception eof) {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
- boolean potentialModification = servConn.getPotentialModification();
+ private static void handleEOFException(Message msg, ServerConnection serverConnection, Exception eof) {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ boolean potentialModification = serverConnection.getPotentialModification();
if (!crHelper.isShutdown()) {
if (potentialModification) {
stats.incAbandonedWriteRequests();
} else {
stats.incAbandonedReadRequests();
}
- if (!suppressIOExceptionLogging) {
+ if (!SUPPRESS_IO_EXCEPTION_LOGGING) {
if (potentialModification) {
- int transId = (msg != null) ? msg.getTransactionId() : Integer.MIN_VALUE;
+ int transId = msg != null ? msg.getTransactionId() : Integer.MIN_VALUE;
logger.warn(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_EOFEXCEPTION_DURING_A_WRITE_OPERATION_ON_REGION__1_KEY_2_MESSAGEID_3,
- new Object[] {servConn.getName(), servConn.getModRegion(), servConn.getModKey(),
- Integer.valueOf(transId)}));
+ new Object[] {serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId }));
} else {
logger.debug("EOF exception", eof);
logger.info(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_CONNECTION_DISCONNECT_DETECTED_BY_EOF,
- servConn.getName()));
+ serverConnection.getName()));
}
}
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(eof);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(eof);
}
- private static void handleInterruptedIOException(Message msg, ServerConnection servConn,
- Exception e) {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- if (!crHelper.isShutdown() && servConn.isOpen()) {
- if (!suppressIOExceptionLogging) {
+ private static void handleInterruptedIOException(ServerConnection serverConnection, Exception e) {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ if (!crHelper.isShutdown() && serverConnection.isOpen()) {
+ if (!SUPPRESS_IO_EXCEPTION_LOGGING) {
if (logger.isDebugEnabled())
logger.debug("Aborted message due to interrupt: {}", e.getMessage(), e);
}
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
}
- private static void handleIOException(Message msg, ServerConnection servConn, Exception e) {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- boolean potentialModification = servConn.getPotentialModification();
+ private static void handleIOException(Message msg, ServerConnection serverConnection, Exception e) {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ boolean potentialModification = serverConnection.getPotentialModification();
- if (!crHelper.isShutdown() && servConn.isOpen()) {
- if (!suppressIOExceptionLogging) {
+ if (!crHelper.isShutdown() && serverConnection.isOpen()) {
+ if (!SUPPRESS_IO_EXCEPTION_LOGGING) {
if (potentialModification) {
- int transId = (msg != null) ? msg.getTransactionId() : Integer.MIN_VALUE;
+ int transId = msg != null ? msg.getTransactionId() : Integer.MIN_VALUE;
logger.warn(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_UNEXPECTED_IOEXCEPTION_DURING_OPERATION_FOR_REGION_1_KEY_2_MESSID_3,
- new Object[] {servConn.getName(), servConn.getModRegion(), servConn.getModKey(),
- Integer.valueOf(transId)}),
+ new Object[] {serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId }),
e);
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_IOEXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
}
}
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
}
- private static void handleShutdownException(Message msg, ServerConnection servConn, Exception e) {
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- boolean potentialModification = servConn.getPotentialModification();
+ private static void handleShutdownException(Message msg, ServerConnection serverConnection, Exception e) {
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ boolean potentialModification = serverConnection.getPotentialModification();
if (!crHelper.isShutdown()) {
if (potentialModification) {
- int transId = (msg != null) ? msg.getTransactionId() : Integer.MIN_VALUE;
+ int transId = msg != null ? msg.getTransactionId() : Integer.MIN_VALUE;
logger.warn(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3,
- new Object[] {servConn.getName(), servConn.getModRegion(), servConn.getModKey(),
- Integer.valueOf(transId)}),
+ new Object[] {serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId }),
e);
} else {
logger.warn(LocalizedMessage.create(
- LocalizedStrings.BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION, servConn.getName()), e);
+ LocalizedStrings.BaseCommand_0_UNEXPECTED_SHUTDOWNEXCEPTION, serverConnection.getName()), e);
}
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
}
- // Handle GemfireSecurityExceptions separately since the connection should not
- // be terminated (by setting processMessages to false) unlike in
- // handleThrowable. Fixes bugs #38384 and #39392.
- // private static void handleGemfireSecurityException(Message msg,
- // ServerConnection servConn, GemFireSecurityException e) {
- //
- // boolean requiresResponse = servConn.getTransientFlag(REQUIRES_RESPONSE);
- // boolean responded = servConn.getTransientFlag(RESPONDED);
- // boolean requiresChunkedResponse = servConn
- // .getTransientFlag(REQUIRES_CHUNKED_RESPONSE);
- // boolean potentialModification = servConn.getPotentialModification();
- //
- // try {
- // try {
- // if (requiresResponse && !responded) {
- // if (requiresChunkedResponse) {
- // writeChunkedException(msg, e, false, servConn);
- // }
- // else {
- // writeException(msg, e, false, servConn);
- // }
- // servConn.setAsTrue(RESPONDED);
- // }
- // }
- // finally { // inner try-finally to ensure proper ordering of logging
- // if (potentialModification) {
- // int transId = (msg != null) ? msg.getTransactionId()
- // : Integer.MIN_VALUE;
- // }
- // }
- // }
- // catch (IOException ioe) {
- // if (logger.isDebugEnabled()) {
- // logger.fine(servConn.getName()
- // + ": Unexpected IOException writing security exception: ", ioe);
- // }
- // }
- // }
-
- private static void handleExceptionNoDisconnect(Message msg, ServerConnection servConn,
+ private static void handleExceptionNoDisconnect(Message msg, ServerConnection serverConnection,
Exception e) {
- boolean requiresResponse = servConn.getTransientFlag(REQUIRES_RESPONSE);
- boolean responded = servConn.getTransientFlag(RESPONDED);
- boolean requiresChunkedResponse = servConn.getTransientFlag(REQUIRES_CHUNKED_RESPONSE);
- boolean potentialModification = servConn.getPotentialModification();
- boolean wroteExceptionResponse = false;
+ boolean requiresResponse = serverConnection.getTransientFlag(REQUIRES_RESPONSE);
+ boolean responded = serverConnection.getTransientFlag(RESPONDED);
+ boolean requiresChunkedResponse = serverConnection.getTransientFlag(REQUIRES_CHUNKED_RESPONSE);
+ boolean potentialModification = serverConnection.getPotentialModification();
try {
+ boolean wroteExceptionResponse = false;
try {
if (requiresResponse && !responded) {
if (requiresChunkedResponse) {
- writeChunkedException(msg, e, false, servConn);
+ writeChunkedException(msg, e, serverConnection);
} else {
- writeException(msg, e, false, servConn);
+ writeException(msg, e, false, serverConnection);
}
wroteExceptionResponse = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
} finally { // inner try-finally to ensure proper ordering of logging
if (potentialModification) {
- int transId = (msg != null) ? msg.getTransactionId() : Integer.MIN_VALUE;
+ int transId = msg != null ? msg.getTransactionId() : Integer.MIN_VALUE;
if (!wroteExceptionResponse) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3,
- new Object[] {servConn.getName(), servConn.getModRegion(), servConn.getModKey(),
- Integer.valueOf(transId)}),
+ new Object[] {serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId }),
e);
} else {
if (logger.isDebugEnabled()) {
logger.debug("{}: Exception during operation on region: {} key: {} messageId: {}",
- servConn.getName(), servConn.getModRegion(), servConn.getModKey(), transId, e);
+ serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId, e);
}
}
} else {
if (!wroteExceptionResponse) {
logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
} else {
if (logger.isDebugEnabled()) {
- logger.debug("{}: Exception: {}", servConn.getName(), e.getMessage(), e);
+ logger.debug("{}: Exception: {}", serverConnection.getName(), e.getMessage(), e);
}
}
}
}
} catch (IOException ioe) {
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected IOException writing exception: {}", servConn.getName(),
+ logger.debug("{}: Unexpected IOException writing exception: {}", serverConnection.getName(),
ioe.getMessage(), ioe);
}
}
}
- private static void handleThrowable(Message msg, ServerConnection servConn, Throwable th) {
- boolean requiresResponse = servConn.getTransientFlag(REQUIRES_RESPONSE);
- boolean responded = servConn.getTransientFlag(RESPONDED);
- boolean requiresChunkedResponse = servConn.getTransientFlag(REQUIRES_CHUNKED_RESPONSE);
- boolean potentialModification = servConn.getPotentialModification();
+ private static void handleThrowable(Message msg, ServerConnection serverConnection, Throwable th) {
+ boolean requiresResponse = serverConnection.getTransientFlag(REQUIRES_RESPONSE);
+ boolean responded = serverConnection.getTransientFlag(RESPONDED);
+ boolean requiresChunkedResponse = serverConnection.getTransientFlag(REQUIRES_CHUNKED_RESPONSE);
+ boolean potentialModification = serverConnection.getPotentialModification();
try {
try {
if (th instanceof Error) {
logger.fatal(LocalizedMessage.create(
- LocalizedStrings.BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER, servConn.getName()), th);
+ LocalizedStrings.BaseCommand_0_UNEXPECTED_ERROR_ON_SERVER, serverConnection.getName()), th);
}
if (requiresResponse && !responded) {
if (requiresChunkedResponse) {
- writeChunkedException(msg, th, false, servConn);
+ writeChunkedException(msg, th, serverConnection);
} else {
- writeException(msg, th, false, servConn);
+ writeException(msg, th, false, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
} finally { // inner try-finally to ensure proper ordering of logging
- if (th instanceof Error) {
- // log nothing
- } else if (th instanceof CancelException) {
- // log nothing
- } else {
+ if (!(th instanceof Error || th instanceof CacheLoaderException)) {
if (potentialModification) {
- int transId = (msg != null) ? msg.getTransactionId() : Integer.MIN_VALUE;
+ int transId = msg != null ? msg.getTransactionId() : Integer.MIN_VALUE;
logger.warn(LocalizedMessage.create(
LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION_DURING_OPERATION_ON_REGION_1_KEY_2_MESSAGEID_3,
- new Object[] {servConn.getName(), servConn.getModRegion(), servConn.getModKey(),
- Integer.valueOf(transId)}),
+ new Object[] {serverConnection.getName(), serverConnection.getModRegion(), serverConnection.getModKey(), transId }),
th);
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), th);
+ serverConnection.getName()), th);
}
}
}
} catch (IOException ioe) {
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected IOException writing exception: {}", servConn.getName(),
+ logger.debug("{}: Unexpected IOException writing exception: {}", serverConnection.getName(),
ioe.getMessage(), ioe);
}
} finally {
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(th);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(th);
}
}
- protected static void writeChunkedException(Message origMsg, Throwable e, boolean isSevere,
- ServerConnection servConn) throws IOException {
- writeChunkedException(origMsg, e, isSevere, servConn, servConn.getChunkedResponseMessage());
+ protected static void writeChunkedException(Message origMsg, Throwable e, ServerConnection serverConnection) throws IOException {
+ writeChunkedException(origMsg, e, serverConnection, serverConnection.getChunkedResponseMessage());
}
- protected static void writeChunkedException(Message origMsg, Throwable e, boolean isSevere,
- ServerConnection servConn, ChunkedMessage originalReponse) throws IOException {
- writeChunkedException(origMsg, e, isSevere, servConn, originalReponse, 2);
+ protected static void writeChunkedException(Message origMsg, Throwable e, ServerConnection serverConnection, ChunkedMessage originalResponse) throws IOException {
+ writeChunkedException(origMsg, e, serverConnection, originalResponse, 2);
}
- protected static void writeChunkedException(Message origMsg, Throwable exception,
- boolean isSevere, ServerConnection servConn, ChunkedMessage originalReponse, int numOfParts)
+ private static void writeChunkedException(Message origMsg, Throwable exception, ServerConnection serverConnection, ChunkedMessage originalResponse, int numOfParts)
throws IOException {
- Throwable e = getClientException(servConn, exception);
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
- chunkedResponseMsg.setServerConnection(servConn);
- if (originalReponse.headerHasBeenSent()) {
- // chunkedResponseMsg = originalReponse;
- // fix for bug 35442
+ Throwable e = getClientException(serverConnection, exception);
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
+ chunkedResponseMsg.setServerConnection(serverConnection);
+ if (originalResponse.headerHasBeenSent()) {
chunkedResponseMsg.setNumberOfParts(numOfParts);
chunkedResponseMsg.setLastChunkAndNumParts(true, numOfParts);
chunkedResponseMsg.addObjPart(e);
@@ -565,7 +492,7 @@ public abstract class BaseCommand implements Command {
chunkedResponseMsg.addStringPart(getExceptionTrace(e));
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk while reply in progress: {}", servConn.getName(),
+ logger.debug("{}: Sending exception chunk while reply in progress: {}", serverConnection.getName(),
e.getMessage(), e);
}
} else {
@@ -579,10 +506,10 @@ public abstract class BaseCommand implements Command {
chunkedResponseMsg.addStringPart(getExceptionTrace(e));
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk: {}", servConn.getName(), e.getMessage(), e);
+ logger.debug("{}: Sending exception chunk: {}", serverConnection.getName(), e.getMessage(), e);
}
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
}
// Get the exception stacktrace for native clients
@@ -595,26 +522,25 @@ public abstract class BaseCommand implements Command {
}
protected static void writeException(Message origMsg, Throwable e, boolean isSevere,
- ServerConnection servConn) throws IOException {
- writeException(origMsg, MessageType.EXCEPTION, e, isSevere, servConn);
+ ServerConnection serverConnection) throws IOException {
+ writeException(origMsg, MessageType.EXCEPTION, e, isSevere, serverConnection);
}
- private static Throwable getClientException(ServerConnection servConn, Throwable e) {
- Cache cache = servConn.getCache();
- if (cache instanceof InternalCache) {
- InternalCache icache = (InternalCache) servConn.getCache();
- OldClientSupportService svc = icache.getService(OldClientSupportService.class);
+ private static Throwable getClientException(ServerConnection serverConnection, Throwable e) {
+ InternalCache cache = serverConnection.getCache();
+ if (cache != null) {
+ OldClientSupportService svc = cache.getService(OldClientSupportService.class);
if (svc != null) {
- return svc.getThrowable(e, servConn.getClientVersion());
+ return svc.getThrowable(e, serverConnection.getClientVersion());
}
}
return e;
}
protected static void writeException(Message origMsg, int msgType, Throwable e, boolean isSevere,
- ServerConnection servConn) throws IOException {
- Throwable theException = getClientException(servConn, e);
- Message errorMsg = servConn.getErrorResponseMessage();
+ ServerConnection serverConnection) throws IOException {
+ Throwable theException = getClientException(serverConnection, e);
+ Message errorMsg = serverConnection.getErrorResponseMessage();
errorMsg.setMessageType(msgType);
errorMsg.setNumberOfParts(2);
errorMsg.setTransactionId(origMsg.getTransactionId());
@@ -628,9 +554,9 @@ public abstract class BaseCommand implements Command {
}
errorMsg.addObjPart(theException);
errorMsg.addStringPart(getExceptionTrace(theException));
- errorMsg.send(servConn);
+ errorMsg.send(serverConnection);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Wrote exception: {}", servConn.getName(), e.getMessage(), e);
+ logger.debug("{}: Wrote exception: {}", serverConnection.getName(), e.getMessage(), e);
}
if (e instanceof MessageTooLargeException) {
throw (IOException) e;
@@ -638,41 +564,41 @@ public abstract class BaseCommand implements Command {
}
protected static void writeErrorResponse(Message origMsg, int messageType,
- ServerConnection servConn) throws IOException {
- Message errorMsg = servConn.getErrorResponseMessage();
+ ServerConnection serverConnection) throws IOException {
+ Message errorMsg = serverConnection.getErrorResponseMessage();
errorMsg.setMessageType(messageType);
errorMsg.setNumberOfParts(1);
errorMsg.setTransactionId(origMsg.getTransactionId());
errorMsg.addStringPart(
LocalizedStrings.BaseCommand_INVALID_DATA_RECEIVED_PLEASE_SEE_THE_CACHE_SERVER_LOG_FILE_FOR_ADDITIONAL_DETAILS
.toLocalizedString());
- errorMsg.send(servConn);
+ errorMsg.send(serverConnection);
}
protected static void writeErrorResponse(Message origMsg, int messageType, String msg,
- ServerConnection servConn) throws IOException {
- Message errorMsg = servConn.getErrorResponseMessage();
+ ServerConnection serverConnection) throws IOException {
+ Message errorMsg = serverConnection.getErrorResponseMessage();
errorMsg.setMessageType(messageType);
errorMsg.setNumberOfParts(1);
errorMsg.setTransactionId(origMsg.getTransactionId());
errorMsg.addStringPart(msg);
- errorMsg.send(servConn);
+ errorMsg.send(serverConnection);
}
protected static void writeRegionDestroyedEx(Message msg, String regionName, String title,
- ServerConnection servConn) throws IOException {
- String reason = servConn.getName() + ": Region named " + regionName + title;
+ ServerConnection serverConnection) throws IOException {
+ String reason = serverConnection.getName() + ": Region named " + regionName + title;
RegionDestroyedException ex = new RegionDestroyedException(reason, regionName);
- if (servConn.getTransientFlag(REQUIRES_CHUNKED_RESPONSE)) {
- writeChunkedException(msg, ex, false, servConn);
+ if (serverConnection.getTransientFlag(REQUIRES_CHUNKED_RESPONSE)) {
+ writeChunkedException(msg, ex, serverConnection);
} else {
- writeException(msg, ex, false, servConn);
+ writeException(msg, ex, false, serverConnection);
}
}
protected static void writeResponse(Object data, Object callbackArg, Message origMsg,
- boolean isObject, ServerConnection servConn) throws IOException {
- Message responseMsg = servConn.getResponseMessage();
+ boolean isObject, ServerConnection serverConnection) throws IOException {
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setTransactionId(origMsg.getTransactionId());
@@ -686,20 +612,20 @@ public abstract class BaseCommand implements Command {
responseMsg.addRawPart((byte[]) data, isObject);
} else {
Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]");
- responseMsg.addObjPart(data, zipValues);
+ responseMsg.addObjPart(data, false);
}
if (callbackArg != null) {
responseMsg.addObjPart(callbackArg);
}
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
- responseMsg.send(servConn);
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
+ responseMsg.send(serverConnection);
origMsg.clearParts();
}
protected static void writeResponseWithRefreshMetadata(Object data, Object callbackArg,
- Message origMsg, boolean isObject, ServerConnection servConn, PartitionedRegion pr,
+ Message origMsg, boolean isObject, ServerConnection serverConnection, PartitionedRegion pr,
byte nwHop) throws IOException {
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setTransactionId(origMsg.getTransactionId());
@@ -713,32 +639,32 @@ public abstract class BaseCommand implements Command {
responseMsg.addRawPart((byte[]) data, isObject);
} else {
Assert.assertTrue(isObject, "isObject should be true when value is not a byte[]");
- responseMsg.addObjPart(data, zipValues);
+ responseMsg.addObjPart(data, false);
}
if (callbackArg != null) {
responseMsg.addObjPart(callbackArg);
}
responseMsg.addBytesPart(new byte[] {pr.getMetadataVersion(), nwHop});
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
- responseMsg.send(servConn);
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
+ responseMsg.send(serverConnection);
origMsg.clearParts();
}
protected static void writeResponseWithFunctionAttribute(byte[] data, Message origMsg,
- ServerConnection servConn) throws IOException {
- Message responseMsg = servConn.getResponseMessage();
+ ServerConnection serverConnection) throws IOException {
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setTransactionId(origMsg.getTransactionId());
responseMsg.setNumberOfParts(1);
responseMsg.addBytesPart(data);
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
- responseMsg.send(servConn);
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
+ responseMsg.send(serverConnection);
origMsg.clearParts();
}
- static protected void checkForInterrupt(ServerConnection servConn, Exception e)
+ protected static void checkForInterrupt(ServerConnection serverConnection, Exception e)
throws InterruptedException, InterruptedIOException {
- servConn.getCachedRegionHelper().checkCancelInProgress(e);
+ serverConnection.getCachedRegionHelper().checkCancelInProgress(e);
if (e instanceof InterruptedException) {
throw (InterruptedException) e;
}
@@ -747,37 +673,35 @@ public abstract class BaseCommand implements Command {
}
}
- protected static void writeQueryResponseChunk(Object queryResponseChunk,
- CollectionType collectionType, boolean lastChunk, ServerConnection servConn)
+ static void writeQueryResponseChunk(Object queryResponseChunk, CollectionType collectionType, boolean lastChunk, ServerConnection serverConnection)
throws IOException {
- ChunkedMessage queryResponseMsg = servConn.getQueryResponseMessage();
+ ChunkedMessage queryResponseMsg = serverConnection.getQueryResponseMessage();
queryResponseMsg.setNumberOfParts(2);
queryResponseMsg.setLastChunk(lastChunk);
- queryResponseMsg.addObjPart(collectionType, zipValues);
- queryResponseMsg.addObjPart(queryResponseChunk, zipValues);
- queryResponseMsg.sendChunk(servConn);
+ queryResponseMsg.addObjPart(collectionType, false);
+ queryResponseMsg.addObjPart(queryResponseChunk, false);
+ queryResponseMsg.sendChunk(serverConnection);
}
- protected static void writeQueryResponseException(Message origMsg, Throwable exception,
- boolean isSevere, ServerConnection servConn) throws IOException {
- Throwable e = getClientException(servConn, exception);
- ChunkedMessage queryResponseMsg = servConn.getQueryResponseMessage();
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ protected static void writeQueryResponseException(Message origMsg, Throwable exception, ServerConnection serverConnection) throws IOException {
+ Throwable e = getClientException(serverConnection, exception);
+ ChunkedMessage queryResponseMsg = serverConnection.getQueryResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
if (queryResponseMsg.headerHasBeenSent()) {
// fix for bug 35442
// This client is expecting 2 parts in this message so send 2 parts
- queryResponseMsg.setServerConnection(servConn);
+ queryResponseMsg.setServerConnection(serverConnection);
queryResponseMsg.setNumberOfParts(2);
queryResponseMsg.setLastChunkAndNumParts(true, 2);
queryResponseMsg.addObjPart(e);
queryResponseMsg.addStringPart(getExceptionTrace(e));
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk while reply in progress: {}", servConn.getName(),
+ logger.debug("{}: Sending exception chunk while reply in progress: {}", serverConnection.getName(),
e.getMessage(), e);
}
- queryResponseMsg.sendChunk(servConn);
+ queryResponseMsg.sendChunk(serverConnection);
} else {
- chunkedResponseMsg.setServerConnection(servConn);
+ chunkedResponseMsg.setServerConnection(serverConnection);
chunkedResponseMsg.setMessageType(MessageType.EXCEPTION);
chunkedResponseMsg.setNumberOfParts(2);
chunkedResponseMsg.setLastChunkAndNumParts(true, 2);
@@ -786,19 +710,18 @@ public abstract class BaseCommand implements Command {
chunkedResponseMsg.addObjPart(e);
chunkedResponseMsg.addStringPart(getExceptionTrace(e));
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk: {}", servConn.getName(), e.getMessage(), e);
+ logger.debug("{}: Sending exception chunk: {}", serverConnection.getName(), e.getMessage(), e);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
}
}
protected static void writeChunkedErrorResponse(Message origMsg, int messageType, String message,
- ServerConnection servConn) throws IOException {
+ ServerConnection serverConnection) throws IOException {
// Send chunked response header identifying error message
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
if (logger.isDebugEnabled()) {
- logger.debug(servConn.getName() + ": Sending error message header type: " + messageType
- + " transaction: " + origMsg.getTransactionId());
+ logger.debug("{}: Sending error message header type: {} transaction: {}", serverConnection.getName(), messageType, origMsg.getTransactionId());
}
chunkedResponseMsg.setMessageType(messageType);
chunkedResponseMsg.setTransactionId(origMsg.getTransactionId());
@@ -806,32 +729,31 @@ public abstract class BaseCommand implements Command {
// Send actual error
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending error message chunk: {}", servConn.getName(), message);
+ logger.debug("{}: Sending error message chunk: {}", serverConnection.getName(), message);
}
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(true);
chunkedResponseMsg.addStringPart(message);
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
}
- protected static void writeFunctionResponseException(Message origMsg, int messageType,
- String message, ServerConnection servConn, Throwable exception) throws IOException {
- Throwable e = getClientException(servConn, exception);
- ChunkedMessage functionResponseMsg = servConn.getFunctionResponseMessage();
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ protected static void writeFunctionResponseException(Message origMsg, int messageType, ServerConnection serverConnection, Throwable exception) throws IOException {
+ Throwable e = getClientException(serverConnection, exception);
+ ChunkedMessage functionResponseMsg = serverConnection.getFunctionResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
if (functionResponseMsg.headerHasBeenSent()) {
- functionResponseMsg.setServerConnection(servConn);
+ functionResponseMsg.setServerConnection(serverConnection);
functionResponseMsg.setNumberOfParts(2);
functionResponseMsg.setLastChunkAndNumParts(true, 2);
functionResponseMsg.addObjPart(e);
functionResponseMsg.addStringPart(getExceptionTrace(e));
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk while reply in progress: {}", servConn.getName(),
+ logger.debug("{}: Sending exception chunk while reply in progress: {}", serverConnection.getName(),
e.getMessage(), e);
}
- functionResponseMsg.sendChunk(servConn);
+ functionResponseMsg.sendChunk(serverConnection);
} else {
- chunkedResponseMsg.setServerConnection(servConn);
+ chunkedResponseMsg.setServerConnection(serverConnection);
chunkedResponseMsg.setMessageType(messageType);
chunkedResponseMsg.setNumberOfParts(2);
chunkedResponseMsg.setLastChunkAndNumParts(true, 2);
@@ -840,9 +762,9 @@ public abstract class BaseCommand implements Command {
chunkedResponseMsg.addObjPart(e);
chunkedResponseMsg.addStringPart(getExceptionTrace(e));
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending exception chunk: {}", servConn.getName(), e.getMessage(), e);
+ logger.debug("{}: Sending exception chunk: {}", serverConnection.getName(), e.getMessage(), e);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
}
}
@@ -898,14 +820,14 @@ public abstract class BaseCommand implements Command {
Message requestMsg = null;
try {
requestMsg = servConn.getRequestMessage();
- requestMsg.recv(servConn, MAX_INCOMING_DATA, incomingDataLimiter, incomingMsgLimiter);
+ requestMsg.recv(servConn, MAX_INCOMING_DATA, INCOMING_DATA_LIMITER, INCOMING_MSG_LIMITER);
return requestMsg;
} catch (EOFException eof) {
handleEOFException(null, servConn, eof);
- // TODO:Asif: Check if there is any need for explicitly returning
+ // TODO: Check if there is any need for explicitly returning
} catch (InterruptedIOException e) { // Solaris only
- handleInterruptedIOException(null, servConn, e);
+ handleInterruptedIOException(servConn, e);
} catch (IOException e) {
handleIOException(null, servConn, e);
@@ -930,7 +852,7 @@ public abstract class BaseCommand implements Command {
fillAndSendRegisterInterestResponseChunks(region, riKey, interestType, false, policy, servConn);
}
- /*
+ /**
* serializeValues is unused for clients < GFE_80
*/
protected static void fillAndSendRegisterInterestResponseChunks(LocalRegion region, Object riKey,
@@ -959,20 +881,20 @@ public abstract class BaseCommand implements Command {
// Not supported yet
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_NOT_YET_SUPPORTED.toLocalizedString());
+
case InterestType.FILTER_CLASS:
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_NOT_YET_SUPPORTED.toLocalizedString());
- // handleFilter(region, (String)riKey, policy);
- // break;
- case InterestType.REGULAR_EXPRESSION: {
+
+ case InterestType.REGULAR_EXPRESSION:
String regEx = (String) riKey;
if (regEx.equals(".*")) {
handleAllKeys(region, policy, servConn);
} else {
handleRegEx(region, regEx, policy, servConn);
}
- }
break;
+
case InterestType.KEY:
if (riKey.equals("ALL_KEYS")) {
handleAllKeys(region, policy, servConn);
@@ -980,13 +902,13 @@ public abstract class BaseCommand implements Command {
handleSingleton(region, riKey, policy, servConn);
}
break;
+
default:
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_UNKNOWN_INTEREST_TYPE.toLocalizedString());
}
}
- @SuppressWarnings("rawtypes")
private static void handleKeysValuesPolicy(LocalRegion region, Object riKey, int interestType,
boolean serializeValues, ServerConnection servConn) throws IOException {
if (riKey instanceof List) {
@@ -1002,9 +924,11 @@ public abstract class BaseCommand implements Command {
case InterestType.OQL_QUERY:
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_NOT_YET_SUPPORTED.toLocalizedString());
+
case InterestType.FILTER_CLASS:
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_NOT_YET_SUPPORTED.toLocalizedString());
+
case InterestType.REGULAR_EXPRESSION:
String regEx = (String) riKey;
if (regEx.equals(".*")) {
@@ -1013,6 +937,7 @@ public abstract class BaseCommand implements Command {
handleKVAllKeys(region, regEx, serializeValues, servConn);
}
break;
+
case InterestType.KEY:
if (riKey.equals("ALL_KEYS")) {
handleKVAllKeys(region, null, serializeValues, servConn);
@@ -1020,6 +945,7 @@ public abstract class BaseCommand implements Command {
handleKVSingleton(region, riKey, serializeValues, servConn);
}
break;
+
default:
throw new InternalGemFireError(
LocalizedStrings.BaseCommand_UNKNOWN_INTEREST_TYPE.toLocalizedString());
@@ -1029,18 +955,14 @@ public abstract class BaseCommand implements Command {
/**
* @param list is a List of entry keys
*/
- protected static void sendRegisterInterestResponseChunk(Region region, Object riKey,
- ArrayList list, boolean lastChunk, ServerConnection servConn) throws IOException {
+ private static void sendRegisterInterestResponseChunk(Region region, Object riKey, List list, boolean lastChunk, ServerConnection servConn) throws IOException {
ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
- String regionName = (region == null) ? " null " : region.getFullPath();
+ chunkedResponseMsg.addObjPart(list, false);
+ String regionName = region == null ? " null " : region.getFullPath();
if (logger.isDebugEnabled()) {
- String str = servConn.getName() + ": Sending" + (lastChunk ? " last " : " ")
- + "register interest response chunk for region: " + regionName + " for keys: " + riKey
- + " chunk=<" + chunkedResponseMsg + ">";
- logger.debug(str);
+ logger.debug("{}: Sending{}register interest response chunk for region: {} for keys: {} chunk=<{}>", servConn.getName(), lastChunk ? " last " : " ", regionName, riKey, chunkedResponseMsg);
}
chunkedResponseMsg.sendChunk(servConn);
@@ -1050,14 +972,12 @@ public abstract class BaseCommand implements Command {
* Determines whether keys for destroyed entries (tombstones) should be sent to clients in
* register-interest results.
*
- * @param servConn
- * @param policy
* @return true if tombstones should be sent to the client
*/
private static boolean sendTombstonesInRIResults(ServerConnection servConn,
InterestResultPolicy policy) {
- return (policy == InterestResultPolicy.KEYS_VALUES)
- && (servConn.getClientVersion().compareTo(Version.GFE_80) >= 0);
+ return policy == InterestResultPolicy.KEYS_VALUES
+ && servConn.getClientVersion().compareTo(Version.GFE_80) >= 0;
}
/**
@@ -1066,7 +986,6 @@ public abstract class BaseCommand implements Command {
* @param region the region
* @param keyList the list of keys
* @param policy the policy
- * @throws IOException
*/
private static void handleList(LocalRegion region, List keyList, InterestResultPolicy policy,
ServerConnection servConn) throws IOException {
@@ -1075,15 +994,13 @@ public abstract class BaseCommand implements Command {
handleListPR((PartitionedRegion) region, keyList, policy, servConn);
return;
}
- ArrayList newKeyList = new ArrayList(maximumChunkSize);
+ List newKeyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
// Handle list of keys
if (region != null) {
- for (Iterator it = keyList.iterator(); it.hasNext();) {
- Object entryKey = it.next();
- if (region.containsKey(entryKey) || (sendTombstonesInRIResults(servConn, policy)
- && region.containsTombstone(entryKey))) {
+ for (Object entryKey : keyList) {
+ if (region.containsKey(entryKey) || sendTombstonesInRIResults(servConn, policy) && region.containsTombstone(entryKey)) {
- appendInterestResponseKey(region, keyList, entryKey, newKeyList, "list", servConn);
+ appendInterestResponseKey(region, keyList, entryKey, newKeyList, servConn);
}
}
}
@@ -1095,13 +1012,11 @@ public abstract class BaseCommand implements Command {
/**
* Handles both RR and PR cases
*/
- @SuppressWarnings("rawtypes")
- @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_NULL_PARAM_DEREF",
+ @SuppressWarnings(value = "NP_NULL_PARAM_DEREF",
justification = "Null value handled in sendNewRegisterInterestResponseChunk()")
private static void handleKVSingleton(LocalRegion region, Object entryKey,
boolean serializeValues, ServerConnection servConn) throws IOException {
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, true,
- region == null ? true : region.getAttributes().getConcurrencyChecksEnabled(),
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, true, region == null || region.getAttributes().getConcurrencyChecksEnabled(),
serializeValues);
if (region != null) {
@@ -1126,15 +1041,14 @@ public abstract class BaseCommand implements Command {
* @param region the region
* @param entryKey the key
* @param policy the policy
- * @throws IOException
*/
private static void handleSingleton(LocalRegion region, Object entryKey,
InterestResultPolicy policy, ServerConnection servConn) throws IOException {
- ArrayList keyList = new ArrayList(1);
+ List keyList = new ArrayList(1);
if (region != null) {
if (region.containsKey(entryKey)
- || (sendTombstonesInRIResults(servConn, policy) && region.containsTombstone(entryKey))) {
- appendInterestResponseKey(region, entryKey, entryKey, keyList, "individual", servConn);
+ || sendTombstonesInRIResults(servConn, policy) && region.containsTombstone(entryKey)) {
+ appendInterestResponseKey(region, entryKey, entryKey, keyList, servConn);
}
}
// Send the last chunk (the only chunk for individual and list keys)
@@ -1147,15 +1061,13 @@ public abstract class BaseCommand implements Command {
*
* @param region the region
* @param policy the policy
- * @throws IOException
*/
private static void handleAllKeys(LocalRegion region, InterestResultPolicy policy,
ServerConnection servConn) throws IOException {
- ArrayList keyList = new ArrayList(maximumChunkSize);
+ List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
if (region != null) {
- for (Iterator it = region.keySet(sendTombstonesInRIResults(servConn, policy)).iterator(); it
- .hasNext();) {
- appendInterestResponseKey(region, "ALL_KEYS", it.next(), keyList, "ALL_KEYS", servConn);
+ for (Object entryKey : region.keySet(sendTombstonesInRIResults(servConn, policy))) {
+ appendInterestResponseKey(region, "ALL_KEYS", entryKey, keyList, servConn);
}
}
// Send the last chunk (the only chunk for individual and list keys)
@@ -1163,30 +1075,19 @@ public abstract class BaseCommand implements Command {
sendRegisterInterestResponseChunk(region, "ALL_KEYS", keyList, true, servConn);
}
- /**
- * @param region
- * @param regex
- * @param serializeValues
- * @param servConn
- * @throws IOException
- */
private static void handleKVAllKeys(LocalRegion region, String regex, boolean serializeValues,
ServerConnection servConn) throws IOException {
- if (region != null && region instanceof PartitionedRegion) {
+ if (region instanceof PartitionedRegion) {
handleKVKeysPR((PartitionedRegion) region, regex, serializeValues, servConn);
return;
}
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, true,
- region == null ? true : region.getAttributes().getConcurrencyChecksEnabled(),
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, true, region == null || region.getAttributes().getConcurrencyChecksEnabled(),
serializeValues);
if (region != null) {
- VersionTag versionTag = null;
- Object data = null;
-
Pattern keyPattern = null;
if (regex != null) {
keyPattern = Pattern.compile(regex);
@@ -1207,11 +1108,11 @@ public abstract class BaseCommand implements Command {
}
ClientProxyMembershipID id = servConn == null ? null : servConn.getProxyID();
- data = region.get(key, null, true, true, true, id, versionHolder, true);
- versionTag = versionHolder.getVersionTag();
+ Object data = region.get(key, null, true, true, true, id, versionHolder, true);
+ VersionTag versionTag = versionHolder.getVersionTag();
updateValues(values, key, data, versionTag);
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
sendNewRegisterInterestResponseChunk(region, regex != null ? regex : "ALL_KEYS", values,
false, servConn);
values.clear();
@@ -1227,20 +1128,18 @@ public abstract class BaseCommand implements Command {
private static void handleKVKeysPR(PartitionedRegion region, Object keyInfo,
boolean serializeValues, ServerConnection servConn) throws IOException {
- int id = 0;
- HashMap<Integer, HashSet> bucketKeys = null;
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, true,
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, true,
region.getConcurrencyChecksEnabled(), serializeValues);
- if (keyInfo != null && keyInfo instanceof List) {
- bucketKeys = new HashMap<Integer, HashSet>();
+ if (keyInfo instanceof List) {
+ HashMap<Integer, HashSet> bucketKeys = new HashMap<>();
for (Object key : (List) keyInfo) {
- id = PartitionedRegionHelper.getHashKey(region, null, key, null, null);
+ int id = PartitionedRegionHelper.getHashKey(region, null, key, null, null);
if (bucketKeys.containsKey(id)) {
bucketKeys.get(id).add(key);
} else {
- HashSet<Object> keys = new HashSet<Object>();
+ HashSet<Object> keys = new HashSet<>();
keys.add(key);
bucketKeys.put(id, keys);
}
@@ -1259,8 +1158,6 @@ public abstract class BaseCommand implements Command {
/**
* Copied from Get70.getValueAndIsObject(), except a minor change. (Make the method static instead
* of copying it here?)
- *
- * @param value
*/
private static void updateValues(VersionedObjectList values, Object key, Object value,
VersionTag versionTag) {
@@ -1274,8 +1171,7 @@ public abstract class BaseCommand implements Command {
boolean wasInvalid = false;
if (value instanceof CachedDeserializable) {
value = ((CachedDeserializable) value).getValue();
- } else if (value == Token.REMOVED_PHASE1 || value == Token.REMOVED_PHASE2
- || value == Token.DESTROYED || value == Token.TOMBSTONE) {
+ } else if (isRemovalToken(value)) {
value = null;
} else if (value == Token.INVALID || value == Token.LOCAL_INVALID) {
value = null; // fix for bug 35884
@@ -1292,46 +1188,39 @@ public abstract class BaseCommand implements Command {
}
}
+ private static boolean isRemovalToken(final Object value) {
+ return value == Token.REMOVED_PHASE1 || value == Token.REMOVED_PHASE2
+ || value == Token.DESTROYED || value == Token.TOMBSTONE;
+ }
+
public static void appendNewRegisterInterestResponseChunkFromLocal(LocalRegion region,
VersionedObjectList values, Object riKeys, Set keySet, ServerConnection servConn)
throws IOException {
ClientProxyMembershipID requestingClient = servConn == null ? null : servConn.getProxyID();
- for (Iterator it = keySet.iterator(); it.hasNext();) {
- Object key = it.next();
+ for (Object key : keySet) {
VersionTagHolder versionHolder = createVersionTagHolder();
Object value = region.get(key, null, true, true, true, requestingClient, versionHolder, true);
updateValues(values, key, value, versionHolder.getVersionTag());
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
// values.setKeys(null); // Now we need to send keys too.
- sendNewRegisterInterestResponseChunk(region, riKeys != null ? riKeys : "ALL_KEYS", values,
- false, servConn);
+ sendNewRegisterInterestResponseChunk(region, riKeys != null ? riKeys : "ALL_KEYS", values, false, servConn);
values.clear();
}
} // for
}
- /**
- *
- * @param region
- * @param values {@link VersionedObjectList}
- * @param riKeys
- * @param set set of entries
- * @param servConn
- * @throws IOException
- */
public static void appendNewRegisterInterestResponseChunk(LocalRegion region,
- VersionedObjectList values, Object riKeys, Set set, ServerConnection servConn)
+ VersionedObjectList values, Object riKeys, Set<Map.Entry> set, ServerConnection servConn)
throws IOException {
- for (Iterator<Map.Entry> it = set.iterator(); it.hasNext();) {
- Map.Entry entry = it.next(); // Region.Entry or Map.Entry
+ for (Entry entry : set) {
if (entry instanceof Region.Entry) { // local entries
- VersionTag vt = null;
- Object key = null;
- Object value = null;
+ VersionTag vt;
+ Object key;
+ Object value;
if (entry instanceof EntrySnapshot) {
vt = ((EntrySnapshot) entry).getVersionTag();
key = ((EntrySnapshot) entry).getRegionEntry().getKey();
@@ -1349,16 +1238,14 @@ public abstract class BaseCommand implements Command {
}
}
} else { // Map.Entry (remote entries)
- ArrayList list = (ArrayList) entry.getValue();
+ List list = (List) entry.getValue();
Object value = list.get(0);
VersionTag tag = (VersionTag) list.get(1);
updateValues(values, entry.getKey(), value, tag);
}
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
- // values.setKeys(null); // Now we need to send keys too.
- sendNewRegisterInterestResponseChunk(region, riKeys != null ? riKeys : "ALL_KEYS", values,
- false, servConn);
+ sendNewRegisterInterestResponseChunk(region, riKeys != null ? riKeys : "ALL_KEYS", values, false, servConn);
values.clear();
}
} // for
@@ -1369,25 +1256,18 @@ public abstract class BaseCommand implements Command {
ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
- String regionName = (region == null) ? " null " : region.getFullPath();
+ chunkedResponseMsg.addObjPart(list, false);
+ String regionName = region == null ? " null " : region.getFullPath();
if (logger.isDebugEnabled()) {
- String str = servConn.getName() + ": Sending" + (lastChunk ? " last " : " ")
- + "register interest response chunk for region: " + regionName + " for keys: " + riKey
- + " chunk=<" + chunkedResponseMsg + ">";
- logger.debug(str);
+ logger.debug("{}: Sending{}register interest response chunk for region: {} for keys: {} chunk=<{}>",
+ servConn.getName(), lastChunk ? " last " : " ", regionName, riKey, chunkedResponseMsg
+ );
}
-
chunkedResponseMsg.sendChunk(servConn);
}
/**
* Process an interest request of type {@link InterestType#REGULAR_EXPRESSION}
- *
- * @param region the region
- * @param regex the regex
- * @param policy the policy
- * @throws IOException
*/
private static void handleRegEx(LocalRegion region, String regex, InterestResultPolicy policy,
ServerConnection servConn) throws IOException {
@@ -1396,13 +1276,11 @@ public abstract class BaseCommand implements Command {
handleRegExPR((PartitionedRegion) region, regex, policy, servConn);
return;
}
- ArrayList keyList = new ArrayList(maximumChunkSize);
+ List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
// Handle the regex pattern
- Pattern keyPattern = Pattern.compile(regex);
if (region != null) {
- for (Iterator it = region.keySet(sendTombstonesInRIResults(servConn, policy)).iterator(); it
- .hasNext();) {
- Object entryKey = it.next();
+ Pattern keyPattern = Pattern.compile(regex);
+ for (Object entryKey : region.keySet(sendTombstonesInRIResults(servConn, policy))) {
if (!(entryKey instanceof String)) {
// key is not a String, cannot apply regex to this entry
continue;
@@ -1412,7 +1290,7 @@ public abstract class BaseCommand implements Command {
continue;
}
- appendInterestResponseKey(region, regex, entryKey, keyList, "regex", servConn);
+ appendInterestResponseKey(region, regex, entryKey, keyList, servConn);
}
}
// Send the last chunk (the only chunk for individual and list keys)
@@ -1422,19 +1300,15 @@ public abstract class BaseCommand implements Command {
/**
* Process an interest request of type {@link InterestType#REGULAR_EXPRESSION}
- *
- * @param region the region
- * @param regex the regex
- * @param policy the policy
- * @throws IOException
*/
private static void handleRegExPR(final PartitionedRegion region, final String regex,
final InterestResultPolicy policy, final ServerConnection servConn) throws IOException {
- final ArrayList keyList = new ArrayList(maximumChunkSize);
+ final List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
region.getKeysWithRegEx(regex, sendTombstonesInRIResults(servConn, policy),
new PartitionedRegion.SetCollector() {
+ @Override
public void receiveSet(Set theSet) throws IOException {
- appendInterestResponseKeys(region, regex, theSet, keyList, "regex", servConn);
+ appendInterestResponseKeys(region, regex, theSet, keyList, servConn);
}
});
// Send the last chunk (the only chunk for individual and list keys)
@@ -1444,19 +1318,15 @@ public abstract class BaseCommand implements Command {
/**
* Process an interest request involving a list of keys
- *
- * @param region the region
- * @param keyList the list of keys
- * @param policy the policy
- * @throws IOException
*/
private static void handleListPR(final PartitionedRegion region, final List keyList,
final InterestResultPolicy policy, final ServerConnection servConn) throws IOException {
- final ArrayList newKeyList = new ArrayList(maximumChunkSize);
+ final List newKeyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
region.getKeysWithList(keyList, sendTombstonesInRIResults(servConn, policy),
new PartitionedRegion.SetCollector() {
+ @Override
public void receiveSet(Set theSet) throws IOException {
- appendInterestResponseKeys(region, keyList, theSet, newKeyList, "list", servConn);
+ appendInterestResponseKeys(region, keyList, theSet, newKeyList, servConn);
}
});
// Send the last chunk (the only chunk for individual and list keys)
@@ -1464,34 +1334,29 @@ public abstract class BaseCommand implements Command {
sendRegisterInterestResponseChunk(region, keyList, newKeyList, true, servConn);
}
- @SuppressWarnings("rawtypes")
private static void handleKVList(final LocalRegion region, final List keyList,
boolean serializeValues, final ServerConnection servConn) throws IOException {
- if (region != null && region instanceof PartitionedRegion) {
+ if (region instanceof PartitionedRegion) {
handleKVKeysPR((PartitionedRegion) region, keyList, serializeValues, servConn);
return;
}
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, true,
- region == null ? true : region.getAttributes().getConcurrencyChecksEnabled(),
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, true, region == null || region.getAttributes().getConcurrencyChecksEnabled(),
serializeValues);
// Handle list of keys
if (region != null) {
- VersionTag versionTag = null;
- Object data = null;
- for (Iterator it = keyList.iterator(); it.hasNext();) {
- Object key = it.next();
+ for (Object key : keyList) {
if (region.containsKey(key) || region.containsTombstone(key)) {
VersionTagHolder versionHolder = createVersionTagHolder();
ClientProxyMembershipID id = servConn == null ? null : servConn.getProxyID();
- data = region.get(key, null, true, true, true, id, versionHolder, true);
- versionTag = versionHolder.getVersionTag();
+ Object data = region.get(key, null, true, true, true, id, versionHolder, true);
+ VersionTag versionTag = versionHolder.getVersionTag();
updateValues(values, key, data, versionTag);
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
// values.setKeys(null); // Now we need to send keys too.
sendNewRegisterInterestResponseChunk(region, keyList, values, false, servConn);
@@ -1518,27 +1383,24 @@ public abstract class BaseCommand implements Command {
* @param riKey the registerInterest "key" (what the client is interested in)
* @param entryKey key we're responding to
* @param list list to append to
- * @param kind for debugging
*/
- private static void appendInterestResponseKey(LocalRegion region, Object riKey, Object entryKey,
- ArrayList list, String kind, ServerConnection servConn) throws IOException {
+ private static void appendInterestResponseKey(LocalRegion region, Object riKey, Object entryKey, List list, ServerConnection servConn) throws IOException {
list.add(entryKey);
if (logger.isDebugEnabled()) {
logger.debug("{}: appendInterestResponseKey <{}>; list size was {}; region: {}",
servConn.getName(), entryKey, list.size(), region.getFullPath());
}
- if (list.size() == maximumChunkSize) {
+ if (list.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendRegisterInterestResponseChunk(region, riKey, list, false, servConn);
list.clear();
}
}
- protected static void appendInterestResponseKeys(LocalRegion region, Object riKey,
- Collection entryKeys, ArrayList collector, String riDescr, ServerConnection servConn)
+ private static void appendInterestResponseKeys(LocalRegion region, Object riKey, Collection entryKeys, List collector, ServerConnection servConn)
throws IOException {
- for (Iterator it = entryKeys.iterator(); it.hasNext();) {
- appendInterestResponseKey(region, riKey, it.next(), collector, riDescr, servConn);
+ for (final Object entryKey : entryKeys) {
+ appendInterestResponseKey(region, riKey, entryKey, collector, servConn);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
index 5f7a8ef..adf702a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/BaseCommandQuery.java
@@ -193,11 +193,11 @@ public abstract class BaseCommandQuery extends BaseCommand {
}
}
- int numberOfChunks = (int) Math.ceil(selectResults.size() * 1.0 / maximumChunkSize);
+ int numberOfChunks = (int) Math.ceil(selectResults.size() * 1.0 / MAXIMUM_CHUNK_SIZE);
if (logger.isTraceEnabled()) {
logger.trace("{}: Query results size: {}: Entries in chunk: {}: Number of chunks: {}",
- servConn.getName(), selectResults.size(), maximumChunkSize, numberOfChunks);
+ servConn.getName(), selectResults.size(), MAXIMUM_CHUNK_SIZE, numberOfChunks);
}
long oldStart = start;
@@ -262,7 +262,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
QueryInvalidException qie =
new QueryInvalidException(LocalizedStrings.BaseCommand_0_QUERYSTRING_IS_1
.toLocalizedString(new Object[] {e.getLocalizedMessage(), queryString}));
- writeQueryResponseException(msg, qie, false, servConn);
+ writeQueryResponseException(msg, qie, servConn);
return false;
} catch (DistributedSystemDisconnectedException se) {
if (msg != null && logger.isDebugEnabled()) {
@@ -282,7 +282,7 @@ public abstract class BaseCommandQuery extends BaseCommand {
if ((defaultQuery).isCanceled()) {
e = new QueryException(defaultQuery.getQueryCanceledException().getMessage(), e.getCause());
}
- writeQueryResponseException(msg, e, false, servConn);
+ writeQueryResponseException(msg, e, servConn);
return false;
} finally {
// Since the query object is being shared in case of bind queries,
@@ -375,8 +375,8 @@ public abstract class BaseCommandQuery extends BaseCommand {
if (logger.isTraceEnabled()) {
logger.trace("{}: Creating chunk: {}", servConn.getName(), j);
}
- Object[] results = new Object[maximumChunkSize];
- for (int i = 0; i < maximumChunkSize; i++) {
+ Object[] results = new Object[MAXIMUM_CHUNK_SIZE];
+ for (int i = 0; i < MAXIMUM_CHUNK_SIZE; i++) {
if ((resultIndex) == selectResults.size()) {
incompleteArray = true;
break;
@@ -427,9 +427,9 @@ public abstract class BaseCommandQuery extends BaseCommand {
if (incompleteArray) {
Object[] newResults;
if (cqQuery != null) {
- newResults = new Object[cqResultIndex % maximumChunkSize];
+ newResults = new Object[cqResultIndex % MAXIMUM_CHUNK_SIZE];
} else {
- newResults = new Object[resultIndex % maximumChunkSize];
+ newResults = new Object[resultIndex % MAXIMUM_CHUNK_SIZE];
}
for (int i = 0; i < newResults.length; i++) {
newResults[i] = results[i];
@@ -463,8 +463,8 @@ public abstract class BaseCommandQuery extends BaseCommand {
if (logger.isTraceEnabled()) {
logger.trace("{}: Creating chunk: {}", servConn.getName(), j);
}
- ObjectPartList serializedObjs = new ObjectPartList(maximumChunkSize, false);
- for (int i = 0; i < maximumChunkSize; i++) {
+ ObjectPartList serializedObjs = new ObjectPartList(MAXIMUM_CHUNK_SIZE, false);
+ for (int i = 0; i < MAXIMUM_CHUNK_SIZE; i++) {
if ((resultIndex) == objs.size()) {
break;
}
[04/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
index c35f420..3c368c5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshConfig.java
@@ -14,12 +14,12 @@
*/
package org.apache.geode.management.internal.cli.shell;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.util.IOUtils;
+
import java.io.File;
import java.util.logging.Level;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-
/**
*
* @since GemFire 7.0
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
index 7c80e0d..2b39bed 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/GfshExecutionStrategy.java
@@ -16,6 +16,7 @@ package org.apache.geode.management.internal.cli.shell;
import static org.apache.geode.management.internal.cli.multistep.CLIMultiStepHelper.execCLISteps;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.CommandProcessingException;
@@ -101,10 +102,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
} catch (NotAuthorizedException e) {
result = ResultBuilder
.createGemFireUnAuthorizedErrorResult("Unauthorized. Reason: " + e.getMessage());
- } catch (JMXInvocationException e) {
- Gfsh.getCurrentInstance().logWarning(e.getMessage(), e);
- } catch (IllegalStateException e) {
- // Shouldn't occur - we are always using GfsParseResult
+ } catch (JMXInvocationException | IllegalStateException e) {
Gfsh.getCurrentInstance().logWarning(e.getMessage(), e);
} catch (CommandProcessingException e) {
Gfsh.getCurrentInstance().logWarning(e.getMessage(), null);
@@ -204,11 +202,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
try {
interceptor = (CliAroundInterceptor) ClassPathLoader.getLatest().forName(interceptorClass)
.newInstance();
- } catch (InstantiationException e) {
- shell.logWarning("Configuration error", e);
- } catch (IllegalAccessException e) {
- shell.logWarning("Configuration error", e);
- } catch (ClassNotFoundException e) {
+ } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
shell.logWarning("Configuration error", e);
}
if (interceptor != null) {
@@ -247,7 +241,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
+ "Please check manager logs for error.");
}
- // the response could be a string which is a json respresentation of the CommandResult object
+ // the response could be a string which is a json representation of the CommandResult object
// it can also be a Path to a temp file downloaded from the rest http request
if (response instanceof String) {
CommandResponse commandResponse =
@@ -259,7 +253,7 @@ public class GfshExecutionStrategy implements ExecutionStrategy {
}
String debugInfo = commandResponse.getDebugInfo();
- if (debugInfo != null && !debugInfo.trim().isEmpty()) {
+ if (StringUtils.isNotBlank(debugInfo)) {
// TODO - Abhishek When debug is ON, log response in gfsh logs
// TODO - Abhishek handle \n better. Is it coming from GemFire formatter
debugInfo = debugInfo.replaceAll("\n\n\n", "\n");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
index e9d183e..7ae7c3b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/shell/JmxOperationInvoker.java
@@ -17,8 +17,8 @@ package org.apache.geode.management.internal.cli.shell;
import static org.apache.geode.distributed.ConfigurationProperties.CLUSTER_SSL_PREFIX;
import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_SSL_PREFIX;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.util.ArrayUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.DistributedSystemMXBean;
@@ -192,7 +192,7 @@ public class JmxOperationInvoker implements OperationInvoker {
URL gfSecurityPropertiesUrl = null;
// Case 1: User has specified gfSecurity properties file
- if (!StringUtils.isBlank(gfSecurityPropertiesPathToUse)) {
+ if (StringUtils.isNotBlank(gfSecurityPropertiesPathToUse)) {
// User specified gfSecurity properties doesn't exist
if (!IOUtils.isExistingPathname(gfSecurityPropertiesPathToUse)) {
gfshInstance
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
index 4410fea..cfb8a24 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/CommandStringBuilder.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.cli.util;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.SystemUtils;
import org.apache.geode.management.internal.cli.GfshParser;
@@ -59,7 +59,7 @@ public class CommandStringBuilder {
}
public CommandStringBuilder addOptionWithValueCheck(String option, String value) {
- if (!StringUtils.isBlank(value)) {
+ if (StringUtils.isNotBlank(value)) {
return addOption(option, value);
}
return this;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
index 0dbe7e5..00902a9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/domain/XmlEntity.java
@@ -14,6 +14,25 @@
*/
package org.apache.geode.management.internal.configuration.domain;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataSerializable;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils.XPathContext;
+import org.apache.logging.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -24,32 +43,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.xpath.XPathExpressionException;
-import org.apache.geode.internal.Assert;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataSerializable;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils.XPathContext;
-
/****
* Domain class for defining a GemFire entity in XML.
*
@@ -156,13 +154,13 @@ public class XmlEntity implements VersionedDataSerializable {
StringBuffer sb = new StringBuffer();
sb.append("//").append(this.prefix).append(':').append(this.parentType);
- if (!StringUtils.isBlank(parentKey) && !StringUtils.isBlank(parentValue)) {
+ if (StringUtils.isNotBlank(parentKey) && StringUtils.isNotBlank(parentValue)) {
sb.append("[@").append(parentKey).append("='").append(parentValue).append("']");
}
sb.append("/").append(childPrefix).append(':').append(this.type);
- if (!StringUtils.isBlank(childKey) && !StringUtils.isBlank(childValue)) {
+ if (StringUtils.isNotBlank(childKey) && StringUtils.isNotBlank(childValue)) {
sb.append("[@").append(childKey).append("='").append(childValue).append("']");
}
this.searchString = sb.toString();
@@ -175,9 +173,9 @@ public class XmlEntity implements VersionedDataSerializable {
* @since GemFire 8.1
*/
private void init() {
- Assert.assertTrue(!StringUtils.isBlank(type));
- Assert.assertTrue(!StringUtils.isBlank(prefix));
- Assert.assertTrue(!StringUtils.isBlank(namespace));
+ Assert.assertTrue(StringUtils.isNotBlank(type));
+ Assert.assertTrue(StringUtils.isNotBlank(prefix));
+ Assert.assertTrue(StringUtils.isNotBlank(namespace));
Assert.assertTrue(attributes != null);
if (null == xmlDefinition) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
index 837d99e..ac5e99a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationRequest.java
@@ -14,18 +14,16 @@
*/
package org.apache.geode.management.internal.configuration.messages;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.Version;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.lang.StringUtils;
-
/***
* Request sent by a member to the locator requesting the shared configuration
*
@@ -50,7 +48,7 @@ public class ConfigurationRequest implements DataSerializableFixedID {
}
public void addGroups(String group) {
- if (!StringUtils.isBlank(group))
+ if (StringUtils.isNotBlank(group))
this.groups.add(group);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
index 3248c98..cb9951f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/messages/ConfigurationResponse.java
@@ -14,6 +14,15 @@
*/
package org.apache.geode.management.internal.configuration.messages;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.InternalGemFireError;
+import org.apache.geode.internal.DataSerializableFixedID;
+import org.apache.geode.internal.Version;
+import org.apache.geode.management.internal.configuration.domain.Configuration;
+import org.apache.geode.management.internal.configuration.utils.XmlUtils;
+import org.xml.sax.SAXException;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -22,21 +31,10 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactoryConfigurationError;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.DataSerializer;
-import org.apache.geode.InternalGemFireError;
-import org.apache.geode.internal.DataSerializableFixedID;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.configuration.domain.Configuration;
-import org.apache.geode.management.internal.configuration.utils.XmlUtils;
-
/***
* Response containing the configuration requested by the {@link ConfigurationRequest}
*/
@@ -127,7 +125,7 @@ public class ConfigurationResponse implements DataSerializableFixedID {
try {
String cacheXmlContent = config.getCacheXmlContent();
- if (!StringUtils.isBlank(cacheXmlContent)) {
+ if (StringUtils.isNotBlank(cacheXmlContent)) {
sb.append("\n" + XmlUtils.prettyXml(cacheXmlContent));
}
} catch (IOException | TransformerFactoryConfigurationError | TransformerException
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
index 218762c..f86b9a3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/utils/XmlUtils.java
@@ -14,12 +14,24 @@
*/
package org.apache.geode.management.internal.configuration.utils;
-import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION;
-import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_PREFIX;
import static javax.xml.XMLConstants.NULL_NS_URI;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
+import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION;
+import static org.apache.geode.management.internal.configuration.utils.XmlConstants.W3C_XML_SCHEMA_INSTANCE_PREFIX;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.cache.xmlcache.CacheXmlParser;
+import org.apache.geode.management.internal.configuration.domain.CacheElement;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
-import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
@@ -33,7 +45,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
-
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -50,20 +61,6 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.internal.cache.xmlcache.CacheXmlParser;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.management.internal.configuration.domain.CacheElement;
-import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-
public class XmlUtils {
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
index 0b64a44..54c29f8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/AbstractCommandsController.java
@@ -15,36 +15,6 @@
package org.apache.geode.management.internal.web.controllers;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.management.ManagementFactory;
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.management.JMX;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.Query;
-import javax.management.QueryExp;
-
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.InitBinder;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.lang.StringUtils;
@@ -64,6 +34,34 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.management.internal.web.controllers.support.LoginHandlerInterceptor;
import org.apache.geode.management.internal.web.util.UriUtils;
import org.apache.geode.security.NotAuthorizedException;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.management.ManagementFactory;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.management.JMX;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.Query;
+import javax.management.QueryExp;
/**
* The AbstractCommandsController class is the abstract base class encapsulating common
@@ -251,7 +249,7 @@ public abstract class AbstractCommandsController {
* @see java.lang.String
*/
protected static boolean hasValue(final String value) {
- return !StringUtils.isBlank(value);
+ return StringUtils.isNotBlank(value);
}
/**
@@ -530,7 +528,7 @@ public abstract class AbstractCommandsController {
if (hasValue(optionValue)) {
final String optionValueString = (optionValue instanceof String[]
- ? StringUtils.concat((String[]) optionValue, StringUtils.COMMA_DELIMITER)
+ ? StringUtils.join((String[]) optionValue, StringUtils.COMMA_DELIMITER)
: String.valueOf(optionValue));
command.addOption(optionName, optionValueString);
} else if (request != null && request.getParameterMap().containsKey(optionName)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
index f468c65..25d0cc3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ConfigCommandsController.java
@@ -14,9 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.io.IOException;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -30,6 +27,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.concurrent.Callable;
+
/**
* The ConfigCommandsController class implements GemFire Management REST API web service endpoints
* for the Gfsh Config Commands.
@@ -184,12 +184,12 @@ public class ConfigCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.EXPORT_CONFIG__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.EXPORT_CONFIG__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(directory)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
index 3a8ed82..ce2ed54 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DataCommandsController.java
@@ -215,12 +215,12 @@ public class DataCommandsController extends AbstractCommandsController {
if (hasValue(includedRegions)) {
command.addOption(CliStrings.REBALANCE__INCLUDEREGION,
- StringUtils.concat(includedRegions, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(includedRegions, StringUtils.COMMA_DELIMITER));
}
if (hasValue(excludedRegions)) {
command.addOption(CliStrings.REBALANCE__EXCLUDEREGION,
- StringUtils.concat(excludedRegions, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(excludedRegions, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.REBALANCE__SIMULATE, String.valueOf(simulate));
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
index fe5be62..35f57ef 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DeployCommandsController.java
@@ -14,13 +14,10 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.io.IOException;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.apache.geode.management.internal.web.util.ConvertUtils;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -28,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+
/**
* The DeployCommandsController class implements the GemFire Management REST API web service
* endpoints for the Gfsh Deploy Commands.
@@ -55,7 +54,7 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_DEPLOYED__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -75,7 +74,7 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.DEPLOY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(jarFileName)) {
@@ -101,12 +100,12 @@ public class DeployCommandsController extends AbstractMultiPartCommandsControlle
if (hasValue(groups)) {
command.addOption(CliStrings.UNDEPLOY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(jarFileNames)) {
command.addOption(CliStrings.UNDEPLOY__JAR,
- StringUtils.concat(jarFileNames, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(jarFileNames, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
index 661340c..fa074c3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DiskStoreCommandsController.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -27,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import java.util.concurrent.Callable;
+
/**
* The DiskStoreCommandsController class implements GemFire Management REST API web service
* endpoints for the Gfsh Disk Store Commands.
@@ -80,7 +80,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.COMPACT_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return getProcessCommandCallable(command.toString());
@@ -115,8 +115,10 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DISK_STORE);
command.addOption(CliStrings.CREATE_DISK_STORE__NAME, diskStoreNameId);
- command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
- StringUtils.concat(directoryAndSizes, StringUtils.COMMA_DELIMITER));
+ if (hasValue(directoryAndSizes)) {
+ command.addOption(CliStrings.CREATE_DISK_STORE__DIRECTORY_AND_SIZE,
+ StringUtils.join(directoryAndSizes, StringUtils.COMMA_DELIMITER));
+ }
command.addOption(CliStrings.CREATE_DISK_STORE__ALLOW_FORCE_COMPACTION,
String.valueOf(Boolean.TRUE.equals(allowForceCompaction)));
command.addOption(CliStrings.CREATE_DISK_STORE__AUTO_COMPACT,
@@ -135,7 +137,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -163,7 +165,7 @@ public class DiskStoreCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.DESTROY_DISK_STORE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
index 1d718b4..8f31f7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/DurableClientCommandsController.java
@@ -19,7 +19,11 @@ import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
/**
* The DurableClientCommandsController class implements GemFire Management REST API web service
@@ -59,7 +63,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_DURABLE_CQS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -109,7 +113,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.COUNT_DURABLE_CQ_EVENTS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -134,7 +138,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.CLOSE_DURABLE_CLIENTS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -161,7 +165,7 @@ public class DurableClientCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.CLOSE_DURABLE_CQS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
index 604bdee..a369c6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ExportLogController.java
@@ -64,7 +64,7 @@ public class ExportLogController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.EXPORT_LOGS__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(memberNameId)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
index 77cfb40..508c335 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/FunctionCommandsController.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.util.concurrent.Callable;
-
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
@@ -27,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import java.util.concurrent.Callable;
+
/**
* The FunctionCommandsController class implements GemFire Management REST API web service endpoints
* for the Gfsh Function Commands.
@@ -60,12 +60,12 @@ public class FunctionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_FUNCTION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.LIST_FUNCTION__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(matches)) {
@@ -108,7 +108,7 @@ public class FunctionCommandsController extends AbstractCommandsController {
if (hasValue(arguments)) {
command.addOption(CliStrings.EXECUTE_FUNCTION__ARGUMENTS,
- StringUtils.concat(arguments, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(arguments, StringUtils.COMMA_DELIMITER));
}
if (hasValue(filter)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
index d19aee1..9b13b5f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/MiscellaneousCommandsController.java
@@ -85,7 +85,7 @@ public class MiscellaneousCommandsController extends AbstractCommandsController
if (hasValue(groups)) {
command.addOption(CliStrings.GC__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -175,7 +175,7 @@ public class MiscellaneousCommandsController extends AbstractCommandsController
if (hasValue(categories)) {
command.addOption(CliStrings.SHOW_METRICS__CATEGORY,
- StringUtils.concat(categories, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(categories, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
index c68ee35..c757fd3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/PdxCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -72,12 +71,12 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(autoSerializerClasses)) {
command.addOption(CliStrings.CONFIGURE_PDX__AUTO__SERIALIZER__CLASSES,
- StringUtils.concat(autoSerializerClasses, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(autoSerializerClasses, StringUtils.COMMA_DELIMITER));
}
if (hasValue(portableAutoSerializerClasses)) {
command.addOption(CliStrings.CONFIGURE_PDX__PORTABLE__AUTO__SERIALIZER__CLASSES,
- StringUtils.concat(portableAutoSerializerClasses, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(portableAutoSerializerClasses, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -97,7 +96,7 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(diskDirs)) {
command.addOption(CliStrings.PDX_DISKDIR,
- StringUtils.concat(diskDirs, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(diskDirs, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -118,7 +117,7 @@ public class PdxCommandsController extends AbstractCommandsController {
if (hasValue(diskDirs)) {
command.addOption(CliStrings.PDX_DISKDIR,
- StringUtils.concat(diskDirs, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(diskDirs, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
index 396726e..df49e49 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/QueueCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -88,12 +87,12 @@ public class QueueCommandsController extends AbstractCommandsController {
if (hasValue(listenerParametersValues)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__LISTENER_PARAM_AND_VALUE,
- StringUtils.concat(listenerParametersValues, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(listenerParametersValues, StringUtils.COMMA_DELIMITER));
}
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__PARALLEL,
@@ -138,7 +137,7 @@ public class QueueCommandsController extends AbstractCommandsController {
if (hasValue(gatewayEventFilters)) {
command.addOption(CliStrings.CREATE_ASYNC_EVENT_QUEUE__GATEWAYEVENTFILTER,
- StringUtils.concat(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewaySubstitutionFilter)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
index e503e56..baf24e5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/RegionCommandsController.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -116,7 +115,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.ALTER_REGION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
addCommandOption(request, command, CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME,
@@ -243,7 +242,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_REGION__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
command.addOption(CliStrings.CREATE_REGION__SKIPIFEXISTS,
@@ -323,7 +322,7 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(cacheListeners)) {
command.addOption(CliStrings.CREATE_REGION__CACHELISTENER,
- StringUtils.concat(cacheListeners, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(cacheListeners, StringUtils.COMMA_DELIMITER));
}
if (hasValue(cacheLoader)) {
@@ -336,12 +335,12 @@ public class RegionCommandsController extends AbstractCommandsController {
if (hasValue(asyncEventQueueIds)) {
command.addOption(CliStrings.CREATE_REGION__ASYNCEVENTQUEUEID,
- StringUtils.concat(asyncEventQueueIds, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(asyncEventQueueIds, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewaySenderIds)) {
command.addOption(CliStrings.CREATE_REGION__GATEWAYSENDERID,
- StringUtils.concat(gatewaySenderIds, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewaySenderIds, StringUtils.COMMA_DELIMITER));
}
if (Boolean.TRUE.equals(enableConcurrencyChecks)) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
index 0ecb77f..e983f2a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/ShellCommandsController.java
@@ -14,14 +14,15 @@
*/
package org.apache.geode.management.internal.web.controllers;
-import java.io.IOException;
-import java.util.Set;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.lang.ObjectUtils;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.web.domain.Link;
+import org.apache.geode.management.internal.web.domain.LinkIndex;
+import org.apache.geode.management.internal.web.domain.QueryParameterSource;
+import org.apache.geode.management.internal.web.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -32,15 +33,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.web.domain.Link;
-import org.apache.geode.management.internal.web.domain.LinkIndex;
-import org.apache.geode.management.internal.web.domain.QueryParameterSource;
-import org.apache.geode.management.internal.web.http.HttpMethod;
+import java.io.IOException;
+import java.util.Set;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
/**
* The ShellCommandsController class implements GemFire REST API calls for Gfsh Shell Commands.
@@ -97,7 +95,7 @@ public class ShellCommandsController extends AbstractCommandsController {
@RequestParam("operationName") final String operationName,
@RequestParam(value = "signature", required = false) String[] signature,
@RequestParam(value = "parameters", required = false) Object[] parameters) {
- signature = (signature != null ? signature : StringUtils.EMPTY_STRING_ARRAY);
+ signature = (signature != null ? signature : ArrayUtils.EMPTY_STRING_ARRAY);
parameters = (parameters != null ? parameters : ObjectUtils.EMPTY_OBJECT_ARRAY);
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
index fa5aa57..4fd4b96 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/controllers/WanCommandsController.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.web.controllers;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
-
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -54,12 +53,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.LIST_GATEWAY__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.LIST_GATEWAY__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -90,7 +89,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(manualStart)) {
@@ -100,7 +99,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(startPort)) {
@@ -127,7 +126,7 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(gatewayTransportFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYRECEIVER__GATEWAYTRANSPORTFILTER,
- StringUtils.concat(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -182,12 +181,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
if (hasValue(parallel)) {
@@ -257,12 +256,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(gatewayEventFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GATEWAYEVENTFILTER,
- StringUtils.concat(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayEventFilters, StringUtils.COMMA_DELIMITER));
}
if (hasValue(gatewayTransportFilters)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER,
- StringUtils.concat(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(gatewayTransportFilters, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -281,12 +280,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.CREATE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
}
@@ -318,12 +317,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.PAUSE_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.PAUSE_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -344,12 +343,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.RESUME_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.RESUME_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -367,12 +366,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.START_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.START_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -393,12 +392,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.START_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.START_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -415,12 +414,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STATUS_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STATUS_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -439,12 +438,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STATUS_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STATUS_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -461,12 +460,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STOP_GATEWAYRECEIVER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STOP_GATEWAYRECEIVER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
@@ -485,12 +484,12 @@ public class WanCommandsController extends AbstractCommandsController {
if (hasValue(groups)) {
command.addOption(CliStrings.STOP_GATEWAYSENDER__GROUP,
- StringUtils.concat(groups, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(groups, StringUtils.COMMA_DELIMITER));
}
if (hasValue(members)) {
command.addOption(CliStrings.STOP_GATEWAYSENDER__MEMBER,
- StringUtils.concat(members, StringUtils.COMMA_DELIMITER));
+ StringUtils.join(members, StringUtils.COMMA_DELIMITER));
}
return processCommand(command.toString());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
index cef8cab..3ec04c7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
@@ -14,16 +14,16 @@
*/
package org.apache.geode.management.internal.web.domain;
-import java.io.Serializable;
-import java.net.URI;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlType;
-
import org.apache.geode.internal.lang.ObjectUtils;
import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.management.internal.web.http.HttpMethod;
import org.apache.geode.management.internal.web.util.UriUtils;
+import java.io.Serializable;
+import java.net.URI;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The Link class models hypermedia controls/link relations.
* <p/>
@@ -97,7 +97,7 @@ public class Link implements Comparable<Link>, Serializable {
}
public final void setRelation(final String relation) {
- assert !StringUtils.isBlank(relation) : "The Link relation (rel) must be specified!";
+ assert StringUtils.isNotBlank(relation) : "The Link relation (rel) must be specified!";
this.relation = relation;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
index 7d5bb37..2a99e82 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/LinkIndex.java
@@ -14,6 +14,8 @@
*/
package org.apache.geode.management.internal.web.domain;
+import org.apache.commons.lang.StringUtils;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -26,8 +28,6 @@ import java.util.TreeSet;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The LinkIndex class is abstraction for modeling an index of Links.
* <p/>
@@ -127,7 +127,7 @@ public class LinkIndex implements Iterable<Link> {
int count = 0;
for (final Link link : this) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(link);
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(link);
}
buffer.append("]");
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
index ee7e932..74836bc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/HttpHeader.java
@@ -14,7 +14,7 @@
*/
package org.apache.geode.management.internal.web.http;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
/**
* The HttpHeader enum is an enumeration of all HTTP request/response header names.
@@ -78,7 +78,7 @@ public enum HttpHeader {
private final String name;
HttpHeader(final String name) {
- assert !StringUtils.isBlank(name) : "The name of the HTTP request header must be specified!";
+ assert StringUtils.isNotBlank(name) : "The name of the HTTP request header must be specified!";
this.name = name;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
index eeedf40..13fd42c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/shell/RestHttpOperationInvoker.java
@@ -15,9 +15,9 @@
package org.apache.geode.management.internal.web.shell;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.Filter;
import org.apache.geode.internal.lang.Initable;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.util.CollectionUtils;
import org.apache.geode.management.internal.cli.CommandRequest;
@@ -447,7 +447,7 @@ public class RestHttpOperationInvoker extends AbstractHttpOperationInvoker imple
@Override
public boolean accept(final Map.Entry<String, String> entry) {
- return !StringUtils.isBlank(entry.getValue());
+ return StringUtils.isNotBlank(entry.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
index f3b092d..0b6fbe3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/ConvertUtils.java
@@ -14,19 +14,18 @@
*/
package org.apache.geode.management.internal.web.util;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.util.IOUtils;
import org.apache.geode.management.internal.cli.CliUtil;
import org.apache.geode.management.internal.web.io.MultipartFileResourceAdapter;
-
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* The ConvertUtils class is a support class for performing conversions used by the GemFire web
* application and REST interface.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
index b83064e..a22ee13 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/util/UriUtils.java
@@ -19,8 +19,6 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Map;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
* The UriUtils is a utility class for processing URIs and URLs.
* <p/>
@@ -32,7 +30,7 @@ import org.apache.geode.internal.lang.StringUtils;
@SuppressWarnings("unused")
public abstract class UriUtils {
- public static final String DEFAULT_ENCODING = StringUtils.UTF_8;
+ public static final String DEFAULT_ENCODING = "UTF-8";
/**
* Decodes the encoded String value using the default encoding, UTF-8. It is assumed the String
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
index c3b349a..7c168dc 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/LocatorTestBase.java
@@ -14,10 +14,20 @@
*/
package org.apache.geode.cache.client.internal;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-
-import org.apache.geode.cache.*;
+import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.server.CacheServer;
@@ -25,16 +35,26 @@ import org.apache.geode.cache.server.ServerLoadProbe;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.Locator;
import org.apache.geode.internal.cache.PoolFactoryImpl;
-import org.apache.geode.test.dunit.*;
+import org.apache.geode.test.dunit.Assert;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.Invoke;
+import org.apache.geode.test.dunit.LogWriterUtils;
+import org.apache.geode.test.dunit.NetworkUtils;
+import org.apache.geode.test.dunit.SerializableCallable;
+import org.apache.geode.test.dunit.SerializableRunnable;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
-import java.util.*;
-
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
/**
*
@@ -198,8 +218,8 @@ public abstract class LocatorTestBase extends JUnit4DistributedTestCase {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, locators);
- if (useGroupsProperty) {
- props.setProperty(GROUPS, StringUtils.concat(groups, ","));
+ if (useGroupsProperty && groups != null) {
+ props.setProperty(GROUPS, StringUtils.join(groups, ","));
}
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
index 09fa09e..bf6a854 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherIntegrationTestCase.java
@@ -17,9 +17,9 @@ package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.junit.Assert.assertTrue;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.process.PidUnavailableException;
import org.apache.geode.internal.process.ProcessStreamReader.InputListener;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
index 62d4bdd..416b459 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
@@ -14,10 +14,14 @@
*/
package org.apache.geode.distributed;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import org.apache.geode.internal.lang.StringUtils;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -108,11 +112,11 @@ public class AbstractLauncherTest {
assertNotNull(distributedSystemProperties);
assertFalse(distributedSystemProperties.containsKey(NAME));
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "333");
+ launcher = createAbstractLauncher(StringUtils.EMPTY, "333");
assertNotNull(launcher);
assertEquals("333", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberName());
distributedSystemProperties = launcher.getDistributedSystemProperties();
@@ -166,11 +170,11 @@ public class AbstractLauncherTest {
assertNull(launcher.getMemberName());
assertEquals("123", launcher.getMember());
- launcher = createAbstractLauncher(StringUtils.EMPTY_STRING, "123");
+ launcher = createAbstractLauncher(StringUtils.EMPTY, "123");
assertNotNull(launcher);
assertEquals("123", launcher.getMemberId());
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberName());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberName());
assertEquals("123", launcher.getMember());
launcher = createAbstractLauncher(" ", "123");
@@ -180,10 +184,10 @@ public class AbstractLauncherTest {
assertEquals(" ", launcher.getMemberName());
assertEquals("123", launcher.getMember());
- launcher = createAbstractLauncher(null, StringUtils.EMPTY_STRING);
+ launcher = createAbstractLauncher(null, StringUtils.EMPTY);
assertNotNull(launcher);
- assertEquals(StringUtils.EMPTY_STRING, launcher.getMemberId());
+ assertEquals(StringUtils.EMPTY, launcher.getMemberId());
assertNull(launcher.getMemberName());
assertNull(launcher.getMember());
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
index 5b53c6a..b856361 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherIntegrationTest.java
@@ -14,6 +14,12 @@
*/
package org.apache.geode.distributed;
+import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
+import static com.googlecode.catchexception.apis.BDDCatchException.when;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.BDDAssertions.assertThat;
+import static org.assertj.core.api.BDDAssertions.then;
+
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
@@ -33,12 +39,6 @@ import java.io.IOException;
import java.net.InetAddress;
import java.util.Properties;
-import static com.googlecode.catchexception.apis.BDDCatchException.caughtException;
-import static com.googlecode.catchexception.apis.BDDCatchException.when;
-import static org.assertj.core.api.BDDAssertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
* Integration tests for LocatorLauncher. These tests require file system I/O.
*/
@@ -110,7 +110,7 @@ public class LocatorLauncherIntegrationTest {
gemfireProperties);
// when: starting with null MemberName
- LocatorLauncher launcher = new Builder().setCommand(Command.START).setMemberName(null).build();
+ LocatorLauncher launcher = new Builder().setCommand(Command.START).build();
// then: name in gemfire.properties file should be used for MemberName
assertThat(launcher).isNotNull();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 06d6054..50cea4d 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -14,13 +14,22 @@
*/
package org.apache.geode.distributed;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import joptsimple.OptionException;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
@@ -29,9 +38,8 @@ import org.junit.rules.TestName;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import joptsimple.OptionException;
-import static org.junit.Assert.*;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
/**
* The LocatorLauncherTest class is a test suite of test cases for testing the contract and
@@ -53,6 +61,11 @@ public class LocatorLauncherTest {
@Rule
public final TestName testName = new TestName();
+ @Before
+ public void setup() {
+ DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testBuilderParseArgumentsWithNonNumericPort() {
try {
@@ -154,8 +167,6 @@ public class LocatorLauncherTest {
assertNull(builder.getHostnameForClients());
assertSame(builder, builder.setHostnameForClients("Pegasus"));
assertEquals("Pegasus", builder.getHostnameForClients());
- assertSame(builder, builder.setHostnameForClients(null));
- assertNull(builder.getHostnameForClients());
}
@Test(expected = IllegalArgumentException.class)
@@ -184,6 +195,19 @@ public class LocatorLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetHostnameForClientsWithNullString() {
+ try {
+ new Builder().setHostnameForClients(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.LocatorLauncher_Builder_INVALID_HOSTNAME_FOR_CLIENTS_ERROR_MESSAGE
+ .toLocalizedString(),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetMemberName() {
Builder builder = new Builder();
@@ -191,8 +215,6 @@ public class LocatorLauncherTest {
assertNull(builder.getMemberName());
assertSame(builder, builder.setMemberName("locatorOne"));
assertEquals("locatorOne", builder.getMemberName());
- assertSame(builder, builder.setMemberName(null));
- assertNull(builder.getMemberName());
}
@Test(expected = IllegalArgumentException.class)
@@ -219,6 +241,18 @@ public class LocatorLauncherTest {
}
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testSetMemberNameWithNullString() {
+ try {
+ new Builder().setMemberName(null);
+ } catch (IllegalArgumentException expected) {
+ assertEquals(
+ LocalizedStrings.Launcher_Builder_MEMBER_NAME_ERROR_MESSAGE.toLocalizedString("Locator"),
+ expected.getMessage());
+ throw expected;
+ }
+ }
+
@Test
public void testSetAndGetPid() {
Builder builder = new Builder();
@@ -299,7 +333,7 @@ public class LocatorLauncherTest {
.setHostnameForClients("beanstock.vmware.com").setMemberName("Beanstock").setPort(8192)
.build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(builder.getCommand(), launcher.getCommand());
assertTrue(launcher.isDebugging());
assertEquals(builder.getHostnameForClients(), launcher.getHostnameForClients());
@@ -312,10 +346,10 @@ public class LocatorLauncherTest {
@Test
public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
- LocatorLauncher launcher = new Builder().setCommand(LocatorLauncher.Command.START)
- .setMemberName(null).set(NAME, "locatorABC").build();
+ LocatorLauncher launcher =
+ new Builder().setCommand(LocatorLauncher.Command.START).set(NAME, "locatorABC").build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
assertNull(launcher.getMemberName());
assertEquals("locatorABC", launcher.getProperties().getProperty(NAME));
@@ -325,10 +359,9 @@ public class LocatorLauncherTest {
public void testBuildWithMemberNameSetInSystemPropertiesOnStart() {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + NAME, "locatorXYZ");
- LocatorLauncher launcher =
- new Builder().setCommand(LocatorLauncher.Command.START).setMemberName(null).build();
+ LocatorLauncher launcher = new Builder().setCommand(LocatorLauncher.Command.START).build();
- assertNotNull(launcher);
+ assertThat(launcher).isNotNull();
assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
assertNull(launcher.getMemberName());
}
[17/28] geode git commit: Cleanup CacheClientNotifier
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/f43c7780/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
index e79bfbd..4bd4970 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java
@@ -93,7 +93,6 @@ import org.apache.geode.internal.cache.ClientRegionEventImpl;
import org.apache.geode.internal.cache.ClientServerObserver;
import org.apache.geode.internal.cache.ClientServerObserverHolder;
import org.apache.geode.internal.cache.Conflatable;
-import org.apache.geode.internal.cache.DistributedRegion;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.EnumListenerEvent;
import org.apache.geode.internal.cache.EventID;
@@ -120,29 +119,158 @@ import org.apache.geode.security.AuthenticationFailedException;
import org.apache.geode.security.AuthenticationRequiredException;
/**
- * Class <code>CacheClientNotifier</code> works on the server and manages client socket connections
- * to clients requesting notification of updates and notifies them when updates occur.
+ * Class {@code CacheClientNotifier} works on the server and manages client socket connections to
+ * clients requesting notification of updates and notifies them when updates occur.
*
* @since GemFire 3.2
*/
-@SuppressWarnings({"synthetic-access", "deprecation"})
public class CacheClientNotifier {
private static final Logger logger = LogService.getLogger();
private static volatile CacheClientNotifier ccnSingleton;
/**
- * Factory method to construct a CacheClientNotifier <code>CacheClientNotifier</code> instance.
+ * The map of known {@code CacheClientProxy} instances. Maps ClientProxyMembershipID to
+ * CacheClientProxy. Note that the keys in this map are not updated when a durable client
+ * reconnects. To make sure you get the updated ClientProxyMembershipID use this map to lookup the
+ * CacheClientProxy and then call getProxyID on it.
+ * <p>
+ * NOTE: package-private to avoid synthetic accessor
+ */
+ final ConcurrentMap/* <ClientProxyMembershipID, CacheClientProxy> */ clientProxies =
+ new ConcurrentHashMap();
+
+ /**
+ * The map of {@code CacheClientProxy} instances which are getting initialized. Maps
+ * ClientProxyMembershipID to CacheClientProxy.
+ */
+ private final ConcurrentMap/* <ClientProxyMembershipID, CacheClientProxy> */ initClientProxies =
+ new ConcurrentHashMap();
+
+ private final Set<ClientProxyMembershipID> timedOutDurableClientProxies = new HashSet<>();
+
+ /**
+ * The GemFire {@code InternalCache}. Note that since this is a singleton class you should not use
+ * a direct reference to cache in CacheClientNotifier code. Instead, you should always use
+ * {@code getCache()}
+ */
+ private InternalCache cache; // TODO: fix synchronization of cache
+
+ private InternalLogWriter logWriter;
+
+ /**
+ * The GemFire security {@code LogWriter}
+ */
+ private InternalLogWriter securityLogWriter;
+
+ /** the maximum number of messages that can be enqueued in a client-queue. */
+ private final int maximumMessageCount;
+
+ /**
+ * the time (in seconds) after which a message in the client queue will expire.
+ */
+ private final int messageTimeToLive;
+
+ /**
+ * A listener which receives notifications about queues that are added or removed
+ */
+ private final ConnectionListener connectionListener;
+
+ private final CacheServerStats acceptorStats;
+
+ /**
+ * haContainer can hold either the name of the client-messages-region (in case of eviction
+ * policies "mem" or "entry") or an instance of HashMap (in case of eviction policy "none"). In
+ * both the cases, it'll store HAEventWrapper as its key and ClientUpdateMessage as its value.
+ */
+ private volatile HAContainerWrapper haContainer;
+
+ /**
+ * The size of the server-to-client communication socket buffers. This can be modified using the
+ * BridgeServer.SOCKET_BUFFER_SIZE system property.
+ */
+ private static final int socketBufferSize =
+ Integer.getInteger("BridgeServer.SOCKET_BUFFER_SIZE", 32768);
+
+ /**
+ * The statistics for this notifier
+ */
+ final CacheClientNotifierStats statistics; // TODO: pass statistics into CacheClientProxy then
+ // make private
+
+ /**
+ * The {@code InterestRegistrationListener} instances registered in this VM. This is used when
+ * modifying the set of listeners.
+ */
+ private final Set writableInterestRegistrationListeners = new CopyOnWriteArraySet();
+
+ /**
+ * The {@code InterestRegistrationListener} instances registered in this VM. This is used to
+ * provide a read-only {@code Set} of listeners.
+ */
+ private final Set readableInterestRegistrationListeners =
+ Collections.unmodifiableSet(this.writableInterestRegistrationListeners);
+
+ /**
+ * System property name for indicating how much frequently the "Queue full" message should be
+ * logged.
+ */
+ private static final String MAX_QUEUE_LOG_FREQUENCY =
+ DistributionConfig.GEMFIRE_PREFIX + "logFrequency.clientQueueReachedMaxLimit";
+
+ public static final long DEFAULT_LOG_FREQUENCY = 1000;
+
+ private static final String EVENT_ENQUEUE_WAIT_TIME_NAME =
+ DistributionConfig.GEMFIRE_PREFIX + "subscription.EVENT_ENQUEUE_WAIT_TIME";
+
+ private static final int DEFAULT_EVENT_ENQUEUE_WAIT_TIME = 100;
+
+ /**
+ * System property value denoting the time in milliseconds. Any thread putting an event into a
+ * subscription queue, which is full, will wait this much time for the queue to make space. It'll
+ * then enque the event possibly causing the queue to grow beyond its capacity/max-size. See
+ * #51400.
+ */
+ public static int eventEnqueueWaitTime; // TODO: encapsulate eventEnqueueWaitTime
+
+ /**
+ * The frequency of logging the "Queue full" message.
+ */
+ private long logFrequency = DEFAULT_LOG_FREQUENCY;
+
+ private final Map<String, DefaultQuery> compiledQueries = new ConcurrentHashMap<>();
+
+ private volatile boolean isCompiledQueryCleanupThreadStarted = false;
+
+ private final Object lockIsCompiledQueryCleanupThreadStarted = new Object();
+
+ private SystemTimer.SystemTimerTask clientPingTask; // TODO: fix synchronization of clientPingTask
+
+ private final SocketCloser socketCloser;
+
+ private static final long CLIENT_PING_TASK_PERIOD =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingPeriod", 60000);
+
+ /**
+ * package-private to avoid synthetic accessor
+ */
+ static final long CLIENT_PING_TASK_COUNTER =
+ Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingCounter", 3);
+
+ private final Set blackListedClients = new CopyOnWriteArraySet();
+
+ /**
+ * Factory method to construct a CacheClientNotifier {@code CacheClientNotifier} instance.
*
- * @param cache The GemFire <code>InternalCache</code>
- * @return A <code>CacheClientNotifier</code> instance
+ * @param cache The GemFire {@code InternalCache}
+ * @return A {@code CacheClientNotifier} instance
*/
public static synchronized CacheClientNotifier getInstance(InternalCache cache,
CacheServerStats acceptorStats, int maximumMessageCount, int messageTimeToLive,
ConnectionListener listener, List overflowAttributesList, boolean isGatewayReceiver) {
if (ccnSingleton == null) {
ccnSingleton = new CacheClientNotifier(cache, acceptorStats, maximumMessageCount,
- messageTimeToLive, listener, overflowAttributesList, isGatewayReceiver);
+ messageTimeToLive, listener, isGatewayReceiver);
}
if (!isGatewayReceiver && ccnSingleton.getHaContainer() == null) {
@@ -158,20 +286,72 @@ public class CacheClientNotifier {
}
/**
+ * @param cache The GemFire {@code InternalCache}
+ * @param listener a listener which should receive notifications abouts queues being added or
+ * removed.
+ */
+ private CacheClientNotifier(InternalCache cache, CacheServerStats acceptorStats,
+ int maximumMessageCount, int messageTimeToLive, ConnectionListener listener,
+ boolean isGatewayReceiver) {
+ // Set the Cache
+ setCache(cache);
+ this.acceptorStats = acceptorStats;
+ // we only need one thread per client and wait 50ms for close
+ this.socketCloser = new SocketCloser(1, 50);
+
+ // Set the LogWriter
+ this.logWriter = (InternalLogWriter) cache.getLogger();
+
+ this.connectionListener = listener;
+
+ // Set the security LogWriter
+ this.securityLogWriter = (InternalLogWriter) cache.getSecurityLogger();
+
+ this.maximumMessageCount = maximumMessageCount;
+ this.messageTimeToLive = messageTimeToLive;
+
+ // Initialize the statistics
+ StatisticsFactory factory;
+ if (isGatewayReceiver) {
+ factory = new DummyStatisticsFactory();
+ } else {
+ factory = getCache().getDistributedSystem();
+ }
+ this.statistics = new CacheClientNotifierStats(factory);
+
+ try {
+ this.logFrequency = Long.valueOf(System.getProperty(MAX_QUEUE_LOG_FREQUENCY));
+ if (this.logFrequency <= 0) {
+ this.logFrequency = DEFAULT_LOG_FREQUENCY;
+ }
+ } catch (Exception e) {
+ this.logFrequency = DEFAULT_LOG_FREQUENCY;
+ }
+
+ eventEnqueueWaitTime =
+ Integer.getInteger(EVENT_ENQUEUE_WAIT_TIME_NAME, DEFAULT_EVENT_ENQUEUE_WAIT_TIME);
+ if (eventEnqueueWaitTime < 0) {
+ eventEnqueueWaitTime = DEFAULT_EVENT_ENQUEUE_WAIT_TIME;
+ }
+
+ // Schedule task to periodically ping clients.
+ scheduleClientPingTask();
+ }
+
+ /**
* Writes a given message to the output stream
*
- * @param dos the <code>DataOutputStream</code> to use for writing the message
+ * @param dos the {@code DataOutputStream} to use for writing the message
* @param type a byte representing the message type
- * @param p_msg the message to be written; can be null
+ * @param message the message to be written; can be null
*/
- private void writeMessage(DataOutputStream dos, byte type, String p_msg, Version clientVersion)
+ private void writeMessage(DataOutputStream dos, byte type, String message, Version clientVersion)
throws IOException {
- writeMessage(dos, type, p_msg, clientVersion, (byte) 0x00, 0);
+ writeMessage(dos, type, message, clientVersion, (byte) 0x00, 0);
}
- private void writeMessage(DataOutputStream dos, byte type, String p_msg, Version clientVersion,
+ private void writeMessage(DataOutputStream dos, byte type, String message, Version clientVersion,
byte epType, int qSize) throws IOException {
- String msg = p_msg;
// write the message type
dos.writeByte(type);
@@ -181,6 +361,7 @@ public class CacheClientNotifier {
// dummy qSize
dos.writeInt(qSize);
+ String msg = message;
if (msg == null) {
msg = "";
}
@@ -188,10 +369,10 @@ public class CacheClientNotifier {
if (clientVersion != null && clientVersion.compareTo(Version.GFE_61) >= 0) {
// get all the instantiators.
Instantiator[] instantiators = InternalInstantiator.getInstantiators();
- HashMap instantiatorMap = new HashMap();
+ Map instantiatorMap = new HashMap();
if (instantiators != null && instantiators.length > 0) {
for (Instantiator instantiator : instantiators) {
- ArrayList instantiatorAttributes = new ArrayList();
+ List<String> instantiatorAttributes = new ArrayList<>();
instantiatorAttributes.add(instantiator.getClass().toString().substring(6));
instantiatorAttributes.add(instantiator.getInstantiatedClass().toString().substring(6));
instantiatorMap.put(instantiator.getId(), instantiatorAttributes);
@@ -201,15 +382,14 @@ public class CacheClientNotifier {
// get all the dataserializers.
DataSerializer[] dataSerializers = InternalDataSerializer.getSerializers();
- HashMap<Integer, ArrayList<String>> dsToSupportedClasses =
- new HashMap<Integer, ArrayList<String>>();
- HashMap<Integer, String> dataSerializersMap = new HashMap<Integer, String>();
+ Map<Integer, List<String>> dsToSupportedClasses = new HashMap<>();
+ Map<Integer, String> dataSerializersMap = new HashMap<>();
if (dataSerializers != null && dataSerializers.length > 0) {
for (DataSerializer dataSerializer : dataSerializers) {
dataSerializersMap.put(dataSerializer.getId(),
dataSerializer.getClass().toString().substring(6));
if (clientVersion.compareTo(Version.GFE_6516) >= 0) {
- ArrayList<String> supportedClassNames = new ArrayList<String>();
+ List<String> supportedClassNames = new ArrayList<>();
for (Class clazz : dataSerializer.getSupportedClasses()) {
supportedClassNames.add(clazz.getName());
}
@@ -228,7 +408,7 @@ public class CacheClientNotifier {
/**
* Writes an exception message to the socket
*
- * @param dos the <code>DataOutputStream</code> to use for writing the message
+ * @param dos the {@code DataOutputStream} to use for writing the message
* @param type a byte representing the exception type
* @param ex the exception to be written; should not be null
*/
@@ -245,7 +425,7 @@ public class CacheClientNotifier {
public void registerClient(Socket socket, boolean isPrimary, long acceptorId,
boolean notifyBySubscription) throws IOException {
// Since no remote ports were specified in the message, wait for them.
- long startTime = this._statistics.startTime();
+ long startTime = this.statistics.startTime();
DataInputStream dis = new DataInputStream(socket.getInputStream());
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
@@ -261,7 +441,7 @@ public class CacheClientNotifier {
SocketAddress sa = socket.getRemoteSocketAddress();
UnsupportedVersionException uve = e;
if (sa != null) {
- String sInfo = " Client: " + sa.toString() + ".";
+ String sInfo = " Client: " + sa + ".";
uve = new UnsupportedVersionException(e.getMessage() + sInfo);
}
logger.warn(
@@ -272,8 +452,7 @@ public class CacheClientNotifier {
return;
}
- // Read and ignore the reply code. This is used on the client to server
- // handshake.
+ // Read and ignore the reply code. This is used on the client to server handshake.
dis.readByte(); // replyCode
if (Version.GFE_57.compareTo(clientVersion) <= 0) {
@@ -289,7 +468,7 @@ public class CacheClientNotifier {
}
}
- protected void registerGFEClient(DataInputStream dis, DataOutputStream dos, Socket socket,
+ private void registerGFEClient(DataInputStream dis, DataOutputStream dos, Socket socket,
boolean isPrimary, long startTime, Version clientVersion, long acceptorId,
boolean notifyBySubscription) throws IOException {
// Read the ports and throw them away. We no longer need them
@@ -299,9 +478,6 @@ public class CacheClientNotifier {
}
// Read the handshake identifier and convert it to a string member id
ClientProxyMembershipID proxyID = null;
- CacheClientProxy proxy;
- AccessControl authzCallback = null;
- byte clientConflation = HandShake.CONFLATION_DEFAULT;
try {
proxyID = ClientProxyMembershipID.readCanonicalized(dis);
if (getBlacklistedClient().contains(proxyID)) {
@@ -309,13 +485,14 @@ public class CacheClientNotifier {
new Exception("This client is blacklisted by server"), clientVersion);
return;
}
- proxy = getClientProxy(proxyID);
+ CacheClientProxy proxy = getClientProxy(proxyID);
DistributedMember member = proxyID.getDistributedMember();
- DistributedSystem system = this.getCache().getDistributedSystem();
+ DistributedSystem system = getCache().getDistributedSystem();
Properties sysProps = system.getProperties();
String authenticator = sysProps.getProperty(SECURITY_CLIENT_AUTHENTICATOR);
+ byte clientConflation;
if (clientVersion.compareTo(Version.GFE_603) >= 0) {
byte[] overrides = HandShake.extractOverrides(new byte[] {(byte) dis.read()});
clientConflation = overrides[0];
@@ -339,27 +516,23 @@ public class CacheClientNotifier {
Properties credentials = HandShake.readCredentials(dis, dos, system);
if (credentials != null && proxy != null) {
- if (securityLogWriter.fineEnabled()) {
- securityLogWriter
+ if (this.securityLogWriter.fineEnabled()) {
+ this.securityLogWriter
.fine("CacheClientNotifier: verifying credentials for proxyID: " + proxyID);
}
Object subject = HandShake.verifyCredentials(authenticator, credentials,
system.getSecurityProperties(), this.logWriter, this.securityLogWriter, member);
if (subject instanceof Principal) {
Principal principal = (Principal) subject;
- if (securityLogWriter.fineEnabled()) {
- securityLogWriter
+ if (this.securityLogWriter.fineEnabled()) {
+ this.securityLogWriter
.fine("CacheClientNotifier: successfully verified credentials for proxyID: "
+ proxyID + " having principal: " + principal.getName());
}
String postAuthzFactoryName = sysProps.getProperty(SECURITY_CLIENT_ACCESSOR_PP);
- if (postAuthzFactoryName != null && postAuthzFactoryName.length() > 0) {
- if (principal == null) {
- securityLogWriter.warning(
- LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_POST_PROCESS_AUTHORIZATION_CALLBACK_ENABLED_BUT_AUTHENTICATION_CALLBACK_0_RETURNED_WITH_NULL_CREDENTIALS_FOR_PROXYID_1,
- new Object[] {SECURITY_CLIENT_AUTHENTICATOR, proxyID});
- }
+ AccessControl authzCallback = null;
+ if (postAuthzFactoryName != null && !postAuthzFactoryName.isEmpty()) {
Method authzMethod = ClassLoadUtil.methodFromName(postAuthzFactoryName);
authzCallback = (AccessControl) authzMethod.invoke(null, (Object[]) null);
authzCallback.init(principal, member, this.getCache());
@@ -374,13 +547,13 @@ public class CacheClientNotifier {
LocalizedStrings.CacheClientNotifier_CLIENTPROXYMEMBERSHIPID_OBJECT_COULD_NOT_BE_CREATED_EXCEPTION_OCCURRED_WAS_0
.toLocalizedString(e));
} catch (AuthenticationRequiredException ex) {
- securityLogWriter.warning(
+ this.securityLogWriter.warning(
LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1,
new Object[] {proxyID, ex});
writeException(dos, HandShake.REPLY_EXCEPTION_AUTHENTICATION_REQUIRED, ex, clientVersion);
return;
} catch (AuthenticationFailedException ex) {
- securityLogWriter.warning(
+ this.securityLogWriter.warning(
LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1,
new Object[] {proxyID, ex});
writeException(dos, HandShake.REPLY_EXCEPTION_AUTHENTICATION_FAILED, ex, clientVersion);
@@ -389,11 +562,10 @@ public class CacheClientNotifier {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CacheClientNotifier_0_REGISTERCLIENT_EXCEPTION_ENCOUNTERED_IN_REGISTRATION_1,
new Object[] {this, e}), e);
- IOException io = new IOException(
+ throw new IOException(
LocalizedStrings.CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_TRYING_TO_REGISTER_INTEREST_DUE_TO_0
- .toLocalizedString(e.getMessage()));
- io.initCause(e);
- throw io;
+ .toLocalizedString(e.getMessage()),
+ e);
} catch (Exception ex) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1,
@@ -402,7 +574,7 @@ public class CacheClientNotifier {
return;
}
- this._statistics.endClientRegistration(startTime);
+ this.statistics.endClientRegistration(startTime);
}
/**
@@ -410,14 +582,13 @@ public class CacheClientNotifier {
*
* @param socket The socket over which the server communicates with the client.
* @param proxyId The distributed member id of the client being registered
- * @param proxy The <code>CacheClientProxy</code> of the given <code>proxyId</code>
+ * @param proxy The {@code CacheClientProxy} of the given {@code proxyId}
*
* @return CacheClientProxy for the registered client
*/
private CacheClientProxy registerClient(Socket socket, ClientProxyMembershipID proxyId,
CacheClientProxy proxy, boolean isPrimary, byte clientConflation, Version clientVersion,
long acceptorId, boolean notifyBySubscription) throws IOException, CacheException {
- CacheClientProxy l_proxy = proxy;
// Initialize the socket
socket.setTcpNoDelay(true);
@@ -431,9 +602,6 @@ public class CacheClientNotifier {
}
// Determine whether the client is durable or not.
- byte responseByte = Acceptor.SUCCESSFUL_SERVER_TO_CLIENT;
- String unsuccessfulMsg = null;
- boolean successful = true;
boolean clientIsDurable = proxyId.isDurable();
if (logger.isDebugEnabled()) {
if (clientIsDurable) {
@@ -446,8 +614,11 @@ public class CacheClientNotifier {
byte epType = 0x00;
int qSize = 0;
+ byte responseByte = Acceptor.SUCCESSFUL_SERVER_TO_CLIENT;
+ String unsuccessfulMsg = null;
+ boolean successful = true;
if (clientIsDurable) {
- if (l_proxy == null) {
+ if (proxy == null) {
if (isTimedOut(proxyId)) {
qSize = PoolImpl.PRIMARY_QUEUE_TIMED_OUT;
} else {
@@ -459,9 +630,9 @@ public class CacheClientNotifier {
"CacheClientNotifier: No proxy exists for durable client with id {}. It must be created.",
proxyId.getDurableId());
}
- l_proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
+ proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
clientVersion, acceptorId, notifyBySubscription);
- successful = this.initializeProxy(l_proxy);
+ successful = this.initializeProxy(proxy);
} else {
if (proxy.isPrimary()) {
epType = (byte) 2;
@@ -470,27 +641,27 @@ public class CacheClientNotifier {
}
qSize = proxy.getQueueSize();
// A proxy exists for this durable client. It must be reinitialized.
- if (l_proxy.isPaused()) {
+ if (proxy.isPaused()) {
if (CacheClientProxy.testHook != null) {
CacheClientProxy.testHook.doTestHook("CLIENT_PRE_RECONNECT");
}
- if (l_proxy.lockDrain()) {
+ if (proxy.lockDrain()) {
try {
if (logger.isDebugEnabled()) {
logger.debug(
"CacheClientNotifier: A proxy exists for durable client with id {}. This proxy will be reinitialized: {}",
- proxyId.getDurableId(), l_proxy);
+ proxyId.getDurableId(), proxy);
}
- this._statistics.incDurableReconnectionCount();
- l_proxy.getProxyID().updateDurableTimeout(proxyId.getDurableTimeout());
- l_proxy.reinitialize(socket, proxyId, this.getCache(), isPrimary, clientConflation,
+ this.statistics.incDurableReconnectionCount();
+ proxy.getProxyID().updateDurableTimeout(proxyId.getDurableTimeout());
+ proxy.reinitialize(socket, proxyId, this.getCache(), isPrimary, clientConflation,
clientVersion);
- l_proxy.setMarkerEnqueued(true);
+ proxy.setMarkerEnqueued(true);
if (CacheClientProxy.testHook != null) {
CacheClientProxy.testHook.doTestHook("CLIENT_RECONNECTED");
}
} finally {
- l_proxy.unlockDrain();
+ proxy.unlockDrain();
}
} else {
unsuccessfulMsg =
@@ -507,7 +678,7 @@ public class CacheClientNotifier {
// client is already using this durable id.
unsuccessfulMsg =
LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_THE_REQUESTED_DURABLE_CLIENT_HAS_THE_SAME_IDENTIFIER__0__AS_AN_EXISTING_DURABLE_CLIENT__1__DUPLICATE_DURABLE_CLIENTS_ARE_NOT_ALLOWED
- .toLocalizedString(new Object[] {proxyId.getDurableId(), proxy});
+ .toLocalizedString(proxyId.getDurableId(), proxy);
logger.warn(unsuccessfulMsg);
// Set the unsuccessful response byte.
responseByte = HandShake.REPLY_EXCEPTION_DUPLICATE_DURABLE_CLIENT;
@@ -537,18 +708,18 @@ public class CacheClientNotifier {
if (toCreateNewProxy) {
// Create the new proxy for this non-durable client
- l_proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
+ proxy = new CacheClientProxy(this, socket, proxyId, isPrimary, clientConflation,
clientVersion, acceptorId, notifyBySubscription);
- successful = this.initializeProxy(l_proxy);
+ successful = this.initializeProxy(proxy);
}
}
if (!successful) {
- l_proxy = null;
+ proxy = null;
responseByte = HandShake.REPLY_REFUSED;
unsuccessfulMsg =
LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_A_PREVIOUS_CONNECTION_ATTEMPT_FROM_THIS_CLIENT_IS_STILL_BEING_PROCESSED__0
- .toLocalizedString(new Object[] {proxyId});
+ .toLocalizedString(proxyId);
}
// Tell the client that the proxy has been registered using the response
@@ -562,10 +733,10 @@ public class CacheClientNotifier {
// write the message type, message length and the error message (if any)
writeMessage(dos, responseByte, unsuccessfulMsg, clientVersion, epType, qSize);
} catch (IOException ioe) {// remove the added proxy if we get IOException.
- if (l_proxy != null) {
- boolean keepProxy = l_proxy.close(false, false); // do not check for queue, just close it
+ if (proxy != null) {
+ boolean keepProxy = proxy.close(false, false); // do not check for queue, just close it
if (!keepProxy) {
- removeClientProxy(l_proxy);
+ removeClientProxy(proxy);
}
}
throw ioe;
@@ -580,41 +751,39 @@ public class CacheClientNotifier {
// will ensure that the response byte is sent to the client before
// the marker message. If the client is durable, the message processor
// is not started until the clientReady message is received.
- if (!clientIsDurable && l_proxy != null
- && responseByte == Acceptor.SUCCESSFUL_SERVER_TO_CLIENT) {
+ if (!clientIsDurable && proxy != null && responseByte == Acceptor.SUCCESSFUL_SERVER_TO_CLIENT) {
// The startOrResumeMessageDispatcher tests if the proxy is a primary.
// If this is a secondary proxy, the dispatcher is not started.
// The false parameter signifies that a marker message has not already been
// processed. This will generate and send one.
- l_proxy.startOrResumeMessageDispatcher(false);
+ proxy.startOrResumeMessageDispatcher(false);
}
if (responseByte == Acceptor.SUCCESSFUL_SERVER_TO_CLIENT) {
if (logger.isDebugEnabled()) {
- logger.debug("CacheClientNotifier: Successfully registered {}", l_proxy);
+ logger.debug("CacheClientNotifier: Successfully registered {}", proxy);
}
} else {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_UNSUCCESSFULLY_REGISTERED_CLIENT_WITH_IDENTIFIER__0,
proxyId));
}
- return l_proxy;
+ return proxy;
}
- private boolean initializeProxy(CacheClientProxy l_proxy) throws IOException, CacheException {
- boolean status = false;
- if (!this.isProxyInInitializationMode(l_proxy)) {
+ private boolean initializeProxy(CacheClientProxy proxy) throws CacheException {
+ if (!this.isProxyInInitializationMode(proxy)) {
if (logger.isDebugEnabled()) {
- logger.debug("Initializing proxy: {}", l_proxy);
+ logger.debug("Initializing proxy: {}", proxy);
}
try {
// Add client proxy to initialization list. This has to be done before
// the queue is created so that events can be buffered here for delivery
// to the queue once it's initialized (bug #41681 and others)
- addClientInitProxy(l_proxy);
- l_proxy.initializeMessageDispatcher();
+ addClientInitProxy(proxy);
+ proxy.initializeMessageDispatcher();
// Initialization success. Add to client proxy list.
- addClientProxy(l_proxy);
+ addClientProxy(proxy);
return true;
} catch (RegionExistsException ree) {
if (logger.isDebugEnabled()) {
@@ -624,10 +793,10 @@ public class CacheClientNotifier {
}
// This will return false;
} finally {
- removeClientInitProxy(l_proxy);
+ removeClientInitProxy(proxy);
}
}
- return status;
+ return false;
}
/**
@@ -670,9 +839,9 @@ public class CacheClientNotifier {
boolean success = false;
CacheClientProxy proxy = getClientProxy(proxyId);
if (proxy != null) {
- HARegionQueue harq = proxy.getHARegionQueue();
- harq.addDispatchedMessage(new ThreadIdentifier(eid.getMembershipID(), eid.getThreadID()),
- eid.getSequenceID());
+ HARegionQueue haRegionQueue = proxy.getHARegionQueue();
+ haRegionQueue.addDispatchedMessage(
+ new ThreadIdentifier(eid.getMembershipID(), eid.getThreadID()), eid.getSequenceID());
success = true;
}
return success;
@@ -690,11 +859,6 @@ public class CacheClientNotifier {
}
CacheClientProxy proxy = getClientProxy(membershipID);
if (proxy != null) {
- // Close the port if the proxy represents the client and contains the
- // port)
- // // If so, remove the port from the client's remote ports
- // proxy.removePort(clientPort);
- // Set the keepalive flag
proxy.setKeepAlive(keepAlive);
}
}
@@ -704,7 +868,7 @@ public class CacheClientNotifier {
*
* @param memberId Uniquely identifies the client
*/
- public void unregisterClient(ClientProxyMembershipID memberId, boolean normalShutdown) {
+ void unregisterClient(ClientProxyMembershipID memberId, boolean normalShutdown) {
if (logger.isDebugEnabled()) {
logger.debug("CacheClientNotifier: Unregistering all clients with member id: {}", memberId);
}
@@ -769,14 +933,16 @@ public class CacheClientNotifier {
* notify interested clients of the given cache event using the given update message. The event
* should have routing information in it that determines which clients will receive the event.
*/
- public static void notifyClients(InternalCacheEvent event, ClientUpdateMessage cmsg) {
+ public static void notifyClients(InternalCacheEvent event,
+ ClientUpdateMessage clientUpdateMessage) {
CacheClientNotifier instance = ccnSingleton;
if (instance != null) {
- instance.singletonNotifyClients(event, cmsg);
+ instance.singletonNotifyClients(event, clientUpdateMessage);
}
}
- private void singletonNotifyClients(InternalCacheEvent event, ClientUpdateMessage cmsg) {
+ private void singletonNotifyClients(InternalCacheEvent event,
+ ClientUpdateMessage clientUpdateMessage) {
final boolean isDebugEnabled = logger.isDebugEnabled();
final boolean isTraceEnabled = logger.isTraceEnabled();
@@ -796,20 +962,20 @@ public class CacheClientNotifier {
return;
}
- long startTime = this._statistics.startTime();
+ long startTime = this.statistics.startTime();
ClientUpdateMessageImpl clientMessage;
- if (cmsg == null) {
+ if (clientUpdateMessage == null) {
clientMessage = constructClientMessage(event);
} else {
- clientMessage = (ClientUpdateMessageImpl) cmsg;
+ clientMessage = (ClientUpdateMessageImpl) clientUpdateMessage;
}
if (clientMessage == null) {
return;
}
// Holds the clientIds to which filter message needs to be sent.
- Set<ClientProxyMembershipID> filterClients = new HashSet();
+ Set<ClientProxyMembershipID> filterClients = new HashSet<>();
// Add CQ info.
if (filterInfo.getCQs() != null) {
@@ -868,7 +1034,7 @@ public class CacheClientNotifier {
}
}
- Conflatable conflatable = null;
+ Conflatable conflatable;
if (clientMessage instanceof ClientTombstoneMessage) {
// bug #46832 - HAEventWrapper deserialization can't handle subclasses
@@ -893,7 +1059,7 @@ public class CacheClientNotifier {
singletonRouteClientMessage(conflatable, filterClients);
- this._statistics.endEvent(startTime);
+ this.statistics.endEvent(startTime);
// Cleanup destroyed events in CQ result cache.
// While maintaining the CQ results key caching. the destroy event
@@ -915,7 +1081,7 @@ public class CacheClientNotifier {
String cqName = regionProfile.getRealCqID(cqID);
if (cqName != null) {
ServerCQ cq = regionProfile.getCq(cqName);
- if (cq != null && e.getValue().equals(Integer.valueOf(MessageType.LOCAL_DESTROY))) {
+ if (cq != null && e.getValue().equals(MessageType.LOCAL_DESTROY)) {
cq.removeFromCqResultKeys(entryEvent.getKey(), true);
}
}
@@ -930,28 +1096,15 @@ public class CacheClientNotifier {
public static void routeClientMessage(Conflatable clientMessage) {
CacheClientNotifier instance = ccnSingleton;
if (instance != null) {
- instance.singletonRouteClientMessage(clientMessage, instance._clientProxies.keySet()); // ok
- // to
- // use
- // keySet
- // here
- // because
- // all
- // we
- // do
- // is
- // call
- // getClientProxy
- // with
- // these
- // keys
+ // ok to use keySet here because all we do is call getClientProxy with these keys
+ instance.singletonRouteClientMessage(clientMessage, instance.clientProxies.keySet());
}
}
/**
* this is for server side registration of client queue
*/
- public static void routeSingleClientMessage(ClientUpdateMessage clientMessage,
+ static void routeSingleClientMessage(ClientUpdateMessage clientMessage,
ClientProxyMembershipID clientProxyMembershipId) {
CacheClientNotifier instance = ccnSingleton;
if (instance != null) {
@@ -963,27 +1116,25 @@ public class CacheClientNotifier {
private void singletonRouteClientMessage(Conflatable conflatable,
Collection<ClientProxyMembershipID> filterClients) {
- this._cache.getCancelCriterion().checkCancelInProgress(null); // bug #43942 - client notified
- // but no p2p distribution
+ this.cache.getCancelCriterion().checkCancelInProgress(null);
List<CacheClientProxy> deadProxies = null;
for (ClientProxyMembershipID clientId : filterClients) {
- CacheClientProxy proxy;
- proxy = this.getClientProxy(clientId, true);
+ CacheClientProxy proxy = this.getClientProxy(clientId, true);
if (proxy != null) {
if (proxy.isAlive() || proxy.isPaused() || proxy.isConnected() || proxy.isDurable()) {
proxy.deliverMessage(conflatable);
} else {
proxy.getStatistics().incMessagesFailedQueued();
if (deadProxies == null) {
- deadProxies = new ArrayList<CacheClientProxy>();
+ deadProxies = new ArrayList<>();
}
deadProxies.add(proxy);
}
- this.blackListSlowReciever(proxy);
+ this.blackListSlowReceiver(proxy);
}
}
- checkAndRemoveFromClientMsgsRegion(conflatable);
+ checkAndRemoveFromClientMessagesRegion(conflatable);
// Remove any dead clients from the clients to notify
if (deadProxies != null) {
closeDeadProxies(deadProxies, false);
@@ -994,7 +1145,7 @@ public class CacheClientNotifier {
* processes the given collection of durable and non-durable client identifiers, returning a
* collection of non-durable identifiers of clients connected to this VM
*/
- public Set<ClientProxyMembershipID> getProxyIDs(Set mixedDurableAndNonDurableIDs) {
+ Set<ClientProxyMembershipID> getProxyIDs(Set mixedDurableAndNonDurableIDs) {
return getProxyIDs(mixedDurableAndNonDurableIDs, false);
}
@@ -1003,52 +1154,44 @@ public class CacheClientNotifier {
* collection of non-durable identifiers of clients connected to this VM. This version can check
* for proxies in initialization as well as fully initialized proxies.
*/
- public Set<ClientProxyMembershipID> getProxyIDs(Set mixedDurableAndNonDurableIDs,
+ private Set<ClientProxyMembershipID> getProxyIDs(Set mixedDurableAndNonDurableIDs,
boolean proxyInInitMode) {
- Set<ClientProxyMembershipID> result = new HashSet();
+ Set<ClientProxyMembershipID> result = new HashSet<>();
for (Object id : mixedDurableAndNonDurableIDs) {
if (id instanceof String) {
CacheClientProxy clientProxy = getClientProxy((String) id, true);
if (clientProxy != null) {
result.add(clientProxy.getProxyID());
}
- // else { we don't have a proxy for the given durable ID }
} else {
// try to canonicalize the ID.
CacheClientProxy proxy = getClientProxy((ClientProxyMembershipID) id, true);
if (proxy != null) {
- // this._logger.info(LocalizedStrings.DEBUG, "BRUCE: found match for " + id + ": " +
- // proxy.getProxyID());
result.add(proxy.getProxyID());
- } else {
- // this._logger.info(LocalizedStrings.DEBUG, "BRUCE: did not find match for " + id);
- // this was causing OOMEs in HARegion initial image processing because
- // messages had routing for clients unknown to this server
- // result.add((ClientProxyMembershipID)id);
}
}
}
return result;
}
- private void blackListSlowReciever(CacheClientProxy clientProxy) {
+ private void blackListSlowReceiver(CacheClientProxy clientProxy) {
final CacheClientProxy proxy = clientProxy;
- if ((proxy.getHARegionQueue() != null && proxy.getHARegionQueue().isClientSlowReciever())
- && !blackListedClients.contains(proxy.getProxyID())) {
+ if (proxy.getHARegionQueue() != null && proxy.getHARegionQueue().isClientSlowReciever()
+ && !this.blackListedClients.contains(proxy.getProxyID())) {
// log alert with client info.
logger.warn(
LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_CLIENT_0_IS_A_SLOW_RECEIVER,
new Object[] {proxy.getProxyID()}));
addToBlacklistedClient(proxy.getProxyID());
- InternalDistributedSystem ids =
- (InternalDistributedSystem) this.getCache().getDistributedSystem();
- final DM dm = ids.getDistributionManager();
+ InternalDistributedSystem system = getCache().getInternalDistributedSystem();
+ final DM dm = system.getDistributionManager();
+
dm.getWaitingThreadPool().execute(new Runnable() {
+ @Override
public void run() {
CacheDistributionAdvisor advisor =
- ((DistributedRegion) proxy.getHARegionQueue().getRegion())
- .getCacheDistributionAdvisor();
+ proxy.getHARegionQueue().getRegion().getCacheDistributionAdvisor();
Set members = advisor.adviseCacheOp();
// Send client blacklist message
@@ -1074,25 +1217,24 @@ public class CacheClientNotifier {
}
/**
- * Initializes a <code>ClientUpdateMessage</code> from an operation and event
+ * Initializes a {@code ClientUpdateMessage} from an operation and event
*
* @param operation The operation that occurred (e.g. AFTER_CREATE)
* @param event The event containing the data to be updated
- * @return a <code>ClientUpdateMessage</code>
+ * @return a {@code ClientUpdateMessage}
*/
- private ClientUpdateMessageImpl initializeMessage(EnumListenerEvent operation, CacheEvent event)
- throws Exception {
+ private ClientUpdateMessageImpl initializeMessage(EnumListenerEvent operation, CacheEvent event) {
if (!supportsOperation(operation)) {
- throw new Exception(
+ throw new UnsupportedOperationException(
LocalizedStrings.CacheClientNotifier_THE_CACHE_CLIENT_NOTIFIER_DOES_NOT_SUPPORT_OPERATIONS_OF_TYPE_0
.toLocalizedString(operation));
}
- // String regionName = event.getRegion().getFullPath();
+
Object keyOfInterest = null;
final EventID eventIdentifier;
ClientProxyMembershipID membershipID = null;
boolean isNetLoad = false;
- Object callbackArgument = null;
+ Object callbackArgument;
byte[] delta = null;
VersionTag versionTag = null;
@@ -1129,19 +1271,19 @@ public class CacheClientNotifier {
}
if (isNetLoad) {
- clientUpdateMsg.setIsNetLoad(isNetLoad);
+ clientUpdateMsg.setIsNetLoad(true);
}
return clientUpdateMsg;
}
/**
- * Returns whether the <code>CacheClientNotifier</code> supports the input operation.
+ * Returns whether the {@code CacheClientNotifier} supports the input operation.
*
* @param operation The operation that occurred (e.g. AFTER_CREATE)
- * @return whether the <code>CacheClientNotifier</code> supports the input operation
+ * @return whether the {@code CacheClientNotifier} supports the input operation
*/
- protected boolean supportsOperation(EnumListenerEvent operation) {
+ private boolean supportsOperation(EnumListenerEvent operation) {
return operation == EnumListenerEvent.AFTER_CREATE
|| operation == EnumListenerEvent.AFTER_UPDATE
|| operation == EnumListenerEvent.AFTER_DESTROY
@@ -1211,7 +1353,7 @@ public class CacheClientNotifier {
int regionDataPolicy) {
if (regionDataPolicy == 0) {
if (!regionsWithEmptyDataPolicy.containsKey(regionName)) {
- regionsWithEmptyDataPolicy.put(regionName, Integer.valueOf(0));
+ regionsWithEmptyDataPolicy.put(regionName, 0);
}
}
}
@@ -1222,8 +1364,8 @@ public class CacheClientNotifier {
* @param regionName The name of the region of interest
* @param keyOfInterest The name of the key of interest
* @param isClosing Whether the caller is closing
- * @param membershipID The <code>ClientProxyMembershipID</code> of the client no longer interested
- * in this <code>Region</code> and key
+ * @param membershipID The {@code ClientProxyMembershipID} of the client no longer interested in
+ * this {@code Region} and key
*/
public void unregisterClientInterest(String regionName, Object keyOfInterest, int interestType,
boolean isClosing, ClientProxyMembershipID membershipID, boolean keepalive) {
@@ -1244,8 +1386,8 @@ public class CacheClientNotifier {
*
* @param regionName The name of the region of interest
* @param keysOfInterest The list of keys of interest
- * @param membershipID The <code>ClientProxyMembershipID</code> of the client no longer interested
- * in this <code>Region</code> and key
+ * @param membershipID The {@code ClientProxyMembershipID} of the client no longer interested in
+ * this {@code Region} and key
*/
public void registerClientInterest(String regionName, List keysOfInterest,
ClientProxyMembershipID membershipID, boolean isDurable, boolean sendUpdatesAsInvalidates,
@@ -1278,8 +1420,8 @@ public class CacheClientNotifier {
* @param regionName The name of the region of interest
* @param keysOfInterest The list of keys of interest
* @param isClosing Whether the caller is closing
- * @param membershipID The <code>ClientProxyMembershipID</code> of the client no longer interested
- * in this <code>Region</code> and key
+ * @param membershipID The {@code ClientProxyMembershipID} of the client no longer interested in
+ * this {@code Region} and key
*/
public void unregisterClientInterest(String regionName, List keysOfInterest, boolean isClosing,
ClientProxyMembershipID membershipID, boolean keepalive) {
@@ -1301,21 +1443,22 @@ public class CacheClientNotifier {
*
* @since GemFire 5.7
*/
- private void checkAndRemoveFromClientMsgsRegion(Conflatable conflatable) {
- if (haContainer == null) {
+ private void checkAndRemoveFromClientMessagesRegion(Conflatable conflatable) {
+ if (this.haContainer == null) {
return;
}
+
if (conflatable instanceof HAEventWrapper) {
HAEventWrapper wrapper = (HAEventWrapper) conflatable;
if (!wrapper.getIsRefFromHAContainer()) {
- wrapper = (HAEventWrapper) haContainer.getKey(wrapper);
+ wrapper = (HAEventWrapper) this.haContainer.getKey(wrapper);
if (wrapper != null && !wrapper.getPutInProgress()) {
synchronized (wrapper) {
if (wrapper.getReferenceCount() == 0L) {
if (logger.isDebugEnabled()) {
logger.debug("Removing event from haContainer: {}", wrapper);
}
- haContainer.remove(wrapper);
+ this.haContainer.remove(wrapper);
}
}
}
@@ -1328,7 +1471,7 @@ public class CacheClientNotifier {
if (logger.isDebugEnabled()) {
logger.debug("Removing event from haContainer: {}", wrapper);
}
- haContainer.remove(wrapper);
+ this.haContainer.remove(wrapper);
}
}
}
@@ -1336,12 +1479,12 @@ public class CacheClientNotifier {
}
/**
- * Returns the <code>CacheClientProxy</code> associated to the membershipID *
+ * Returns the {@code CacheClientProxy} associated to the membershipID *
*
- * @return the <code>CacheClientProxy</code> associated to the membershipID
+ * @return the {@code CacheClientProxy} associated to the membershipID
*/
public CacheClientProxy getClientProxy(ClientProxyMembershipID membershipID) {
- return (CacheClientProxy) this._clientProxies.get(membershipID);
+ return (CacheClientProxy) this.clientProxies.get(membershipID);
}
/**
@@ -1352,25 +1495,25 @@ public class CacheClientNotifier {
boolean proxyInInitMode) {
CacheClientProxy proxy = getClientProxy(membershipID);
if (proxyInInitMode && proxy == null) {
- proxy = (CacheClientProxy) this._initClientProxies.get(membershipID);
+ proxy = (CacheClientProxy) this.initClientProxies.get(membershipID);
}
return proxy;
}
/**
- * Returns the <code>CacheClientProxy</code> associated to the durableClientId
+ * Returns the {@code CacheClientProxy} associated to the durableClientId
*
- * @return the <code>CacheClientProxy</code> associated to the durableClientId
+ * @return the {@code CacheClientProxy} associated to the durableClientId
*/
public CacheClientProxy getClientProxy(String durableClientId) {
return getClientProxy(durableClientId, false);
}
/**
- * Returns the <code>CacheClientProxy</code> associated to the durableClientId. This version of
- * the method can check for initializing proxies as well as fully initialized proxies.
+ * Returns the {@code CacheClientProxy} associated to the durableClientId. This version of the
+ * method can check for initializing proxies as well as fully initialized proxies.
*
- * @return the <code>CacheClientProxy</code> associated to the durableClientId
+ * @return the {@code CacheClientProxy} associated to the durableClientId
*/
public CacheClientProxy getClientProxy(String durableClientId, boolean proxyInInitMode) {
final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -1379,9 +1522,9 @@ public class CacheClientNotifier {
if (isDebugEnabled) {
logger.debug("CacheClientNotifier: Determining client for {}", durableClientId);
}
+
CacheClientProxy proxy = null;
- for (Iterator i = getClientProxies().iterator(); i.hasNext();) {
- CacheClientProxy clientProxy = (CacheClientProxy) i.next();
+ for (CacheClientProxy clientProxy : getClientProxies()) {
if (isTraceEnabled) {
logger.trace("CacheClientNotifier: Checking client {}", clientProxy);
}
@@ -1394,9 +1537,10 @@ public class CacheClientNotifier {
break;
}
}
+
if (proxy == null && proxyInInitMode) {
- for (Iterator i = this._initClientProxies.values().iterator(); i.hasNext();) {
- CacheClientProxy clientProxy = (CacheClientProxy) i.next();
+ for (Object clientProxyObject : this.initClientProxies.values()) {
+ CacheClientProxy clientProxy = (CacheClientProxy) clientProxyObject;
if (isTraceEnabled) {
logger.trace("CacheClientNotifier: Checking initializing client {}", clientProxy);
}
@@ -1415,37 +1559,6 @@ public class CacheClientNotifier {
}
/**
- * Returns the <code>CacheClientProxySameDS</code> associated to the membershipID *
- *
- * @return the <code>CacheClientProxy</code> associated to the same distributed system
- */
- public CacheClientProxy getClientProxySameDS(ClientProxyMembershipID membershipID) {
- final boolean isDebugEnabled = logger.isDebugEnabled();
- if (isDebugEnabled) {
- logger.debug("{}::getClientProxySameDS(), Determining client for host {}", this,
- membershipID);
- logger.debug("{}::getClientProxySameDS(), Number of proxies in the Cache Clinet Notifier: {}",
- this, getClientProxies().size());
- }
- CacheClientProxy proxy = null;
- for (Iterator i = getClientProxies().iterator(); i.hasNext();) {
- CacheClientProxy clientProxy = (CacheClientProxy) i.next();
- if (isDebugEnabled) {
- logger.debug("CacheClientNotifier: Checking client {}", clientProxy);
- }
- if (clientProxy.isSameDSMember(membershipID)) {
- proxy = clientProxy;
- if (isDebugEnabled) {
- logger.debug("CacheClientNotifier: {} represents the client running on host {}", proxy,
- membershipID);
- }
- break;
- }
- }
- return proxy;
- }
-
- /**
* It will remove the clients connected to the passed acceptorId. If its the only server, shuts
* down this instance.
*/
@@ -1453,10 +1566,10 @@ public class CacheClientNotifier {
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
logger.debug("At cache server shutdown time, the number of cache servers in the cache is {}",
- this.getCache().getCacheServers().size());
+ getCache().getCacheServers().size());
}
- Iterator it = this._clientProxies.values().iterator();
+ Iterator it = this.clientProxies.values().iterator();
// Close all the client proxies
while (it.hasNext()) {
CacheClientProxy proxy = (CacheClientProxy) it.next();
@@ -1478,27 +1591,27 @@ public class CacheClientNotifier {
if (noActiveServer() && ccnSingleton != null) {
ccnSingleton = null;
- if (haContainer != null) {
- haContainer.cleanUp();
+ if (this.haContainer != null) {
+ this.haContainer.cleanUp();
if (isDebugEnabled) {
- logger.debug("haContainer ({}) is now cleaned up.", haContainer.getName());
+ logger.debug("haContainer ({}) is now cleaned up.", this.haContainer.getName());
}
}
this.clearCompiledQueries();
- blackListedClients.clear();
+ this.blackListedClients.clear();
// cancel the ping task
this.clientPingTask.cancel();
// Close the statistics
- this._statistics.close();
+ this.statistics.close();
this.socketCloser.close();
}
}
private boolean noActiveServer() {
- for (CacheServer server : this.getCache().getCacheServers()) {
+ for (CacheServer server : getCache().getCacheServers()) {
if (server.isRunning()) {
return false;
}
@@ -1507,41 +1620,40 @@ public class CacheClientNotifier {
}
/**
- * Adds a new <code>CacheClientProxy</code> to the list of known client proxies
+ * Adds a new {@code CacheClientProxy} to the list of known client proxies
*
- * @param proxy The <code>CacheClientProxy</code> to add
+ * @param proxy The {@code CacheClientProxy} to add
*/
- protected void addClientProxy(CacheClientProxy proxy) throws IOException {
- // this._logger.info(LocalizedStrings.DEBUG, "adding client proxy " + proxy);
+ void addClientProxy(CacheClientProxy proxy) {
getCache(); // ensure cache reference is up to date so firstclient state is correct
- this._clientProxies.put(proxy.getProxyID(), proxy);
+ this.clientProxies.put(proxy.getProxyID(), proxy);
// Remove this proxy from the init proxy list.
removeClientInitProxy(proxy);
- this._connectionListener.queueAdded(proxy.getProxyID());
- if (!(proxy.clientConflation == HandShake.CONFLATION_ON)) {
+ this.connectionListener.queueAdded(proxy.getProxyID());
+ if (proxy.clientConflation != HandShake.CONFLATION_ON) {
// Delta not supported with conflation ON
- ClientHealthMonitor chm = ClientHealthMonitor.getInstance();
+ ClientHealthMonitor clientHealthMonitor = ClientHealthMonitor.getInstance();
/*
* #41788 - If the client connection init starts while cache/member is shutting down,
* ClientHealthMonitor.getInstance() might return null.
*/
- if (chm != null) {
- chm.numOfClientsPerVersion.incrementAndGet(proxy.getVersion().ordinal());
+ if (clientHealthMonitor != null) {
+ clientHealthMonitor.numOfClientsPerVersion.incrementAndGet(proxy.getVersion().ordinal());
}
}
this.timedOutDurableClientProxies.remove(proxy.getProxyID());
}
- protected void addClientInitProxy(CacheClientProxy proxy) throws IOException {
- this._initClientProxies.put(proxy.getProxyID(), proxy);
+ private void addClientInitProxy(CacheClientProxy proxy) {
+ this.initClientProxies.put(proxy.getProxyID(), proxy);
}
- protected void removeClientInitProxy(CacheClientProxy proxy) throws IOException {
- this._initClientProxies.remove(proxy.getProxyID());
+ private void removeClientInitProxy(CacheClientProxy proxy) {
+ this.initClientProxies.remove(proxy.getProxyID());
}
- protected boolean isProxyInInitializationMode(CacheClientProxy proxy) throws IOException {
- return this._initClientProxies.containsKey(proxy.getProxyID());
+ private boolean isProxyInInitializationMode(CacheClientProxy proxy) {
+ return this.initClientProxies.containsKey(proxy.getProxyID());
}
/**
@@ -1552,8 +1664,7 @@ public class CacheClientNotifier {
*/
public Set getActiveClients() {
Set clients = new HashSet();
- for (Iterator iter = getClientProxies().iterator(); iter.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) iter.next();
+ for (CacheClientProxy proxy : getClientProxies()) {
if (proxy.hasRegisteredInterested()) {
ClientProxyMembershipID proxyID = proxy.getProxyID();
clients.add(proxyID);
@@ -1569,8 +1680,8 @@ public class CacheClientNotifier {
*/
public Map getAllClients() {
Map clients = new HashMap();
- for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) iter.next();
+ for (final Object o : this.clientProxies.values()) {
+ CacheClientProxy proxy = (CacheClientProxy) o;
ClientProxyMembershipID proxyID = proxy.getProxyID();
clients.put(proxyID, new CacheClientStatus(proxyID));
}
@@ -1586,8 +1697,8 @@ public class CacheClientNotifier {
* @since GemFire 5.6
*/
public boolean hasDurableClient(String durableId) {
- for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) iter.next();
+ for (Object clientProxyObject : this.clientProxies.values()) {
+ CacheClientProxy proxy = (CacheClientProxy) clientProxyObject;
ClientProxyMembershipID proxyID = proxy.getProxyID();
if (durableId.equals(proxyID.getDurableId())) {
return true;
@@ -1605,15 +1716,11 @@ public class CacheClientNotifier {
* @since GemFire 5.6
*/
public boolean hasPrimaryForDurableClient(String durableId) {
- for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) iter.next();
+ for (Object clientProxyObject : this.clientProxies.values()) {
+ CacheClientProxy proxy = (CacheClientProxy) clientProxyObject;
ClientProxyMembershipID proxyID = proxy.getProxyID();
if (durableId.equals(proxyID.getDurableId())) {
- if (proxy.isPrimary()) {
- return true;
- } else {
- return false;
- }
+ return proxy.isPrimary();
}
}
return false;
@@ -1626,9 +1733,9 @@ public class CacheClientNotifier {
*/
public Map getClientQueueSizes() {
Map/* <ClientProxyMembershipID,Integer> */ queueSizes = new HashMap();
- for (Iterator iter = this._clientProxies.values().iterator(); iter.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) iter.next();
- queueSizes.put(proxy.getProxyID(), Integer.valueOf(proxy.getQueueSize()));
+ for (Object clientProxyObject : this.clientProxies.values()) {
+ CacheClientProxy proxy = (CacheClientProxy) clientProxyObject;
+ queueSizes.put(proxy.getProxyID(), proxy.getQueueSize());
}
return queueSizes;
}
@@ -1645,25 +1752,20 @@ public class CacheClientNotifier {
public boolean closeClientCq(String durableClientId, String clientCQName) throws CqException {
CacheClientProxy proxy = getClientProxy(durableClientId);
// close and drain
- if (proxy != null) {
- return proxy.closeClientCq(clientCQName);
- }
- return false;
+ return proxy != null && proxy.closeClientCq(clientCQName);
}
/**
- * Removes an existing <code>CacheClientProxy</code> from the list of known client proxies
+ * Removes an existing {@code CacheClientProxy} from the list of known client proxies
*
- * @param proxy The <code>CacheClientProxy</code> to remove
+ * @param proxy The {@code CacheClientProxy} to remove
*/
- protected void removeClientProxy(CacheClientProxy proxy) {
- // this._logger.info(LocalizedStrings.DEBUG, "removing client proxy " + proxy, new
- // Exception("stack trace"));
+ void removeClientProxy(CacheClientProxy proxy) {
ClientProxyMembershipID client = proxy.getProxyID();
- this._clientProxies.remove(client);
- this._connectionListener.queueRemoved();
- this.getCache().cleanupForClient(this, client);
- if (!(proxy.clientConflation == HandShake.CONFLATION_ON)) {
+ this.clientProxies.remove(client);
+ this.connectionListener.queueRemoved();
+ getCache().cleanupForClient(this, client);
+ if (proxy.clientConflation != HandShake.CONFLATION_ON) {
ClientHealthMonitor chm = ClientHealthMonitor.getInstance();
if (chm != null) {
chm.numOfClientsPerVersion.decrementAndGet(proxy.getVersion().ordinal());
@@ -1675,18 +1777,18 @@ public class CacheClientNotifier {
this.timedOutDurableClientProxies.add(client);
}
- public boolean isTimedOut(ClientProxyMembershipID client) {
+ private boolean isTimedOut(ClientProxyMembershipID client) {
return this.timedOutDurableClientProxies.contains(client);
}
/**
- * Returns an unmodifiable Collection of known <code>CacheClientProxy</code> instances. The
- * collection is not static so its contents may change.
+ * Returns an unmodifiable Collection of known {@code CacheClientProxy} instances. The collection
+ * is not static so its contents may change.
*
- * @return the collection of known <code>CacheClientProxy</code> instances
+ * @return the collection of known {@code CacheClientProxy} instances
*/
public Collection<CacheClientProxy> getClientProxies() {
- return Collections.unmodifiableCollection(this._clientProxies.values());
+ return Collections.unmodifiableCollection(this.clientProxies.values());
}
private void closeAllClientCqs(CacheClientProxy proxy) {
@@ -1698,12 +1800,12 @@ public class CacheClientNotifier {
logger.debug("CacheClientNotifier: Closing client CQs: {}", proxy);
}
cqService.closeClientCqs(proxy.getProxyID());
- } catch (CqException e1) {
+ } catch (CqException e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.CacheClientNotifier_UNABLE_TO_CLOSE_CQS_FOR_THE_CLIENT__0,
proxy.getProxyID()));
if (isDebugEnabled) {
- e1.printStackTrace();
+ logger.debug(e);
}
}
}
@@ -1732,16 +1834,17 @@ public class CacheClientNotifier {
}
/**
- * Close dead <code>CacheClientProxy</code> instances
+ * Close dead {@code CacheClientProxy} instances
*
- * @param deadProxies The list of <code>CacheClientProxy</code> instances to close
+ * @param deadProxies The list of {@code CacheClientProxy} instances to close
*/
private void closeDeadProxies(List deadProxies, boolean stoppedNormally) {
final boolean isDebugEnabled = logger.isDebugEnabled();
- for (Iterator i = deadProxies.iterator(); i.hasNext();) {
- CacheClientProxy proxy = (CacheClientProxy) i.next();
- if (isDebugEnabled)
+ for (Object deadProxy : deadProxies) {
+ CacheClientProxy proxy = (CacheClientProxy) deadProxy;
+ if (isDebugEnabled) {
logger.debug("CacheClientNotifier: Closing dead client: {}", proxy);
+ }
// Close the proxy
boolean keepProxy = false;
@@ -1757,8 +1860,7 @@ public class CacheClientNotifier {
if (keepProxy) {
logger.info(LocalizedMessage.create(
LocalizedStrings.CacheClientNotifier_CACHECLIENTNOTIFIER_KEEPING_PROXY_FOR_DURABLE_CLIENT_NAMED_0_FOR_1_SECONDS_2,
- new Object[] {proxy.getDurableId(), Integer.valueOf(proxy.getDurableTimeout()),
- proxy}));
+ new Object[] {proxy.getDurableId(), proxy.getDurableTimeout(), proxy}));
} else {
closeAllClientCqs(proxy);
if (isDebugEnabled) {
@@ -1771,10 +1873,10 @@ public class CacheClientNotifier {
}
/**
- * Registers a new <code>InterestRegistrationListener</code> with the set of
- * <code>InterestRegistrationListener</code>s.
+ * Registers a new {@code InterestRegistrationListener} with the set of
+ * {@code InterestRegistrationListener}s.
*
- * @param listener The <code>InterestRegistrationListener</code> to register
+ * @param listener The {@code InterestRegistrationListener} to register
*
* @since GemFire 5.8Beta
*/
@@ -1783,10 +1885,10 @@ public class CacheClientNotifier {
}
/**
- * Unregisters an existing <code>InterestRegistrationListener</code> from the set of
- * <code>InterestRegistrationListener</code>s.
+ * Unregisters an existing {@code InterestRegistrationListener} from the set of
+ * {@code InterestRegistrationListener}s.
*
- * @param listener The <code>InterestRegistrationListener</code> to unregister
+ * @param listener The {@code InterestRegistrationListener} to unregister
*
* @since GemFire 5.8Beta
*/
@@ -1795,11 +1897,11 @@ public class CacheClientNotifier {
}
/**
- * Returns a read-only collection of <code>InterestRegistrationListener</code>s registered with
- * this notifier.
+ * Returns a read-only collection of {@code InterestRegistrationListener}s registered with this
+ * notifier.
*
- * @return a read-only collection of <code>InterestRegistrationListener</code>s registered with
- * this notifier
+ * @return a read-only collection of {@code InterestRegistrationListener}s registered with this
+ * notifier
*
* @since GemFire 5.8Beta
*/
@@ -1811,17 +1913,17 @@ public class CacheClientNotifier {
*
* @since GemFire 5.8Beta
*/
- protected boolean containsInterestRegistrationListeners() {
+ boolean containsInterestRegistrationListeners() {
return !this.writableInterestRegistrationListeners.isEmpty();
}
/**
- *
* @since GemFire 5.8Beta
*/
- protected void notifyInterestRegistrationListeners(InterestRegistrationEvent event) {
- for (Iterator i = this.writableInterestRegistrationListeners.iterator(); i.hasNext();) {
- InterestRegistrationListener listener = (InterestRegistrationListener) i.next();
+ void notifyInterestRegistrationListeners(InterestRegistrationEvent event) {
+ for (Object writableInterestRegistrationListener : this.writableInterestRegistrationListeners) {
+ InterestRegistrationListener listener =
+ (InterestRegistrationListener) writableInterestRegistrationListener;
if (event.isRegister()) {
listener.afterRegisterInterest(event);
} else {
@@ -1836,207 +1938,70 @@ public class CacheClientNotifier {
* @return the statistics for the notifier
*/
public CacheClientNotifierStats getStats() {
- return this._statistics;
+ return this.statistics;
}
/**
- * Returns this <code>CacheClientNotifier</code>'s <code>InternalCache</code>.
+ * Returns this {@code CacheClientNotifier}'s {@code InternalCache}.
*
- * @return this <code>CacheClientNotifier</code>'s <code>InternalCache</code>
+ * @return this {@code CacheClientNotifier}'s {@code InternalCache}
*/
protected InternalCache getCache() { // TODO:SYNC: looks wrong
- if (this._cache != null && this._cache.isClosed()) {
+ if (this.cache != null && this.cache.isClosed()) {
InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null) {
- this._cache = cache;
+ this.cache = cache;
this.logWriter = cache.getInternalLogWriter();
this.securityLogWriter = cache.getSecurityInternalLogWriter();
}
}
- return this._cache;
+ return this.cache;
}
/**
- * Returns this <code>CacheClientNotifier</code>'s maximum message count.
+ * Returns this {@code CacheClientNotifier}'s maximum message count.
*
- * @return this <code>CacheClientNotifier</code>'s maximum message count
+ * @return this {@code CacheClientNotifier}'s maximum message count
*/
protected int getMaximumMessageCount() {
return this.maximumMessageCount;
}
/**
- * Returns this <code>CacheClientNotifier</code>'s message time-to-live.
+ * Returns this {@code CacheClientNotifier}'s message time-to-live.
*
- * @return this <code>CacheClientNotifier</code>'s message time-to-live
+ * @return this {@code CacheClientNotifier}'s message time-to-live
*/
protected int getMessageTimeToLive() {
return this.messageTimeToLive;
}
- protected void handleInterestEvent(InterestRegistrationEvent event) {
+ void handleInterestEvent(InterestRegistrationEvent event) {
LocalRegion region = (LocalRegion) event.getRegion();
region.handleInterestEvent(event);
}
- /**
- * @param cache The GemFire <code>InternalCache</code>
- * @param listener a listener which should receive notifications abouts queues being added or
- * removed.
- */
- private CacheClientNotifier(InternalCache cache, CacheServerStats acceptorStats,
- int maximumMessageCount, int messageTimeToLive, ConnectionListener listener,
- List overflowAttributesList, boolean isGatewayReceiver) {
- // Set the Cache
- setCache(cache);
- this.acceptorStats = acceptorStats;
- this.socketCloser = new SocketCloser(1, 50); // we only need one thread per client and wait 50ms
- // for close
-
- // Set the LogWriter
- this.logWriter = (InternalLogWriter) cache.getLogger();
-
- this._connectionListener = listener;
-
- // Set the security LogWriter
- this.securityLogWriter = (InternalLogWriter) cache.getSecurityLogger();
-
- this.maximumMessageCount = maximumMessageCount;
- this.messageTimeToLive = messageTimeToLive;
-
- // Initialize the statistics
- StatisticsFactory factory;
- if (isGatewayReceiver) {
- factory = new DummyStatisticsFactory();
- } else {
- factory = this.getCache().getDistributedSystem();
- }
- this._statistics = new CacheClientNotifierStats(factory);
-
- try {
- this.logFrequency = Long.valueOf(System.getProperty(MAX_QUEUE_LOG_FREQUENCY));
- if (this.logFrequency <= 0) {
- this.logFrequency = DEFAULT_LOG_FREQUENCY;
- }
- } catch (Exception e) {
- this.logFrequency = DEFAULT_LOG_FREQUENCY;
- }
-
- eventEnqueueWaitTime =
- Integer.getInteger(EVENT_ENQUEUE_WAIT_TIME_NAME, DEFAULT_EVENT_ENQUEUE_WAIT_TIME);
- if (eventEnqueueWaitTime < 0) {
- eventEnqueueWaitTime = DEFAULT_EVENT_ENQUEUE_WAIT_TIME;
- }
-
- // Schedule task to periodically ping clients.
- scheduleClientPingTask();
- }
-
- /**
- * this message is used to send interest registration to another server. Since interest
- * registration performs a state-flush operation this message must not transmitted on an ordered
- * socket
- */
- public static class ServerInterestRegistrationMessage extends HighPriorityDistributionMessage
- implements MessageWithReply {
- ClientProxyMembershipID clientId;
- ClientInterestMessageImpl clientMessage;
- int processorId;
-
- ServerInterestRegistrationMessage(ClientProxyMembershipID clientID,
- ClientInterestMessageImpl msg) {
- this.clientId = clientID;
- this.clientMessage = msg;
- }
-
- public ServerInterestRegistrationMessage() {}
-
- static void sendInterestChange(DM dm, ClientProxyMembershipID clientID,
- ClientInterestMessageImpl msg) {
- ServerInterestRegistrationMessage smsg = new ServerInterestRegistrationMessage(clientID, msg);
- Set recipients = dm.getOtherDistributionManagerIds();
- smsg.setRecipients(recipients);
- ReplyProcessor21 rp = new ReplyProcessor21(dm, recipients);
- smsg.processorId = rp.getProcessorId();
- dm.putOutgoing(smsg);
- try {
- rp.waitForReplies();
- } catch (InterruptedException ie) {
- Thread.currentThread().interrupt();
- }
- }
-
- @Override
- protected void process(DistributionManager dm) {
- // Get the proxy for the proxy id
- try {
- CacheClientNotifier ccn = CacheClientNotifier.getInstance();
- if (ccn != null) {
- CacheClientProxy proxy = ccn.getClientProxy(clientId);
- // If this VM contains a proxy for the requested proxy id, forward the
- // message on to the proxy for processing
- if (proxy != null) {
- proxy.processInterestMessage(this.clientMessage);
- }
- }
- } finally {
- ReplyMessage reply = new ReplyMessage();
- reply.setProcessorId(this.processorId);
- reply.setRecipient(getSender());
- try {
- dm.putOutgoing(reply);
- } catch (CancelException e) {
- // can't send a reply, so ignore the exception
- }
- }
- }
-
- public int getDSFID() {
- return SERVER_INTEREST_REGISTRATION_MESSAGE;
- }
-
- @Override
- public void toData(DataOutput out) throws IOException {
- super.toData(out);
- out.writeInt(this.processorId);
- InternalDataSerializer.invokeToData(this.clientId, out);
- InternalDataSerializer.invokeToData(this.clientMessage, out);
- }
-
- @Override
- public void fromData(DataInput in) throws IOException, ClassNotFoundException {
- super.fromData(in);
- this.processorId = in.readInt();
- this.clientId = new ClientProxyMembershipID();
- InternalDataSerializer.invokeFromData(this.clientId, in);
- this.clientMessage = new ClientInterestMessageImpl();
- InternalDataSerializer.invokeFromData(this.clientMessage, in);
- }
- }
-
- protected void deliverInterestChange(ClientProxyMembershipID proxyID,
- ClientInterestMessageImpl message) {
- DM dm = ((InternalDistributedSystem) this.getCache().getDistributedSystem())
- .getDistributionManager();
+ void deliverInterestChange(ClientProxyMembershipID proxyID, ClientInterestMessageImpl message) {
+ DM dm = getCache().getInternalDistributedSystem().getDistributionManager();
ServerInterestRegistrationMessage.sendInterestChange(dm, proxyID, message);
}
- public CacheServerStats getAcceptorStats() {
+ CacheServerStats getAcceptorStats() {
return this.acceptorStats;
}
- public SocketCloser getSocketCloser() {
+ SocketCloser getSocketCloser() {
return this.socketCloser;
}
public void addCompiledQuery(DefaultQuery query) {
if (this.compiledQueries.putIfAbsent(query.getQueryString(), query) == null) {
// Added successfully.
- this._statistics.incCompiledQueryCount(1);
+ this.statistics.incCompiledQueryCount(1);
if (logger.isDebugEnabled()) {
logger.debug(
"Added compiled query into ccn.compliedQueries list. Query: {}. Total compiled queries: {}",
- query.getQueryString(), this._statistics.getCompiledQueryCount());
+ query.getQueryString(), this.statistics.getCompiledQueryCount());
}
// Start the clearIdleCompiledQueries thread.
startCompiledQueryCleanupThread();
@@ -2048,13 +2013,13 @@ public class CacheClientNotifier {
}
private void clearCompiledQueries() {
- if (this.compiledQueries.size() > 0) {
- this._statistics.incCompiledQueryCount(-(this.compiledQueries.size()));
+ if (!this.compiledQueries.isEmpty()) {
+ this.statistics.incCompiledQueryCount(-this.compiledQueries.size());
this.compiledQueries.clear();
if (logger.isDebugEnabled()) {
logger.debug(
"Removed all compiled queries from ccn.compliedQueries list. Total compiled queries: {}",
- this._statistics.getCompiledQueryCount());
+ this.statistics.getCompiledQueryCount());
}
}
}
@@ -2064,7 +2029,7 @@ public class CacheClientNotifier {
* checks for the compiled queries that are not used and removes them.
*/
private void startCompiledQueryCleanupThread() {
- if (isCompiledQueryCleanupThreadStarted) {
+ if (this.isCompiledQueryCleanupThreadStarted) {
return;
}
@@ -2082,11 +2047,11 @@ public class CacheClientNotifier {
} else {
if (compiledQueries.remove(e.getKey()) != null) {
// If successfully removed decrement the counter.
- _statistics.incCompiledQueryCount(-1);
+ statistics.incCompiledQueryCount(-1);
if (isDebugEnabled) {
logger.debug("Removed compiled query from ccn.compliedQueries list. Query: "
+ q.getQueryString() + ". Total compiled queries are : "
- + _statistics.getCompiledQueryCount());
+ + statistics.getCompiledQueryCount());
}
}
}
@@ -2094,23 +2059,23 @@ public class CacheClientNotifier {
}
};
- synchronized (lockIsCompiledQueryCleanupThreadStarted) {
- if (!isCompiledQueryCleanupThreadStarted) {
+ synchronized (this.lockIsCompiledQueryCleanupThreadStarted) {
+ if (!this.isCompiledQueryCleanupThreadStarted) {
long period = DefaultQuery.TEST_COMPILED_QUERY_CLEAR_TIME > 0
? DefaultQuery.TEST_COMPILED_QUERY_CLEAR_TIME : DefaultQuery.COMPILED_QUERY_CLEAR_TIME;
- _cache.getCCPTimer().scheduleAtFixedRate(task, period, period);
+ this.cache.getCCPTimer().scheduleAtFixedRate(task, period, period);
}
- isCompiledQueryCleanupThreadStarted = true;
+ this.isCompiledQueryCleanupThreadStarted = true;
}
}
- protected void scheduleClientPingTask() {
+ void scheduleClientPingTask() {
this.clientPingTask = new SystemTimer.SystemTimerTask() {
@Override
public void run2() {
// If there are no proxies, return
- if (CacheClientNotifier.this._clientProxies.isEmpty()) {
+ if (clientProxies.isEmpty()) {
return;
}
@@ -2145,144 +2110,10 @@ public class CacheClientNotifier {
if (logger.isDebugEnabled()) {
logger.debug("Scheduling client ping task with period={} ms", CLIENT_PING_TASK_PERIOD);
}
- CacheClientNotifier.this._cache.getCCPTimer().scheduleAtFixedRate(this.clientPingTask,
+ CacheClientNotifier.this.cache.getCCPTimer().scheduleAtFixedRate(this.clientPingTask,
CLIENT_PING_TASK_PERIOD, CLIENT_PING_TASK_PERIOD);
}
- /**
- * A string representing all hosts used for delivery purposes.
- */
- protected static final String ALL_HOSTS = "ALL_HOSTS";
-
- /**
- * An int representing all ports used for delivery purposes.
- */
- protected static final int ALL_PORTS = -1;
-
- /**
- * The map of known <code>CacheClientProxy</code> instances. Maps ClientProxyMembershipID to
- * CacheClientProxy. Note that the keys in this map are not updated when a durable client
- * reconnects. To make sure you get the updated ClientProxyMembershipID use this map to lookup the
- * CacheClientProxy and then call getProxyID on it.
- */
- private final ConcurrentMap/* <ClientProxyMembershipID, CacheClientProxy> */ _clientProxies =
- new ConcurrentHashMap();
-
- /**
- * The map of <code>CacheClientProxy</code> instances which are getting initialized. Maps
- * ClientProxyMembershipID to CacheClientProxy.
- */
- private final ConcurrentMap/* <ClientProxyMembershipID, CacheClientProxy> */ _initClientProxies =
- new ConcurrentHashMap();
-
- private final HashSet<ClientProxyMembershipID> timedOutDurableClientProxies =
- new HashSet<ClientProxyMembershipID>();
-
- /**
- * The GemFire <code>InternalCache</code>. Note that since this is a singleton class you should
- * not use a direct reference to _cache in CacheClientNotifier code. Instead, you should always
- * use <code>getCache()</code>
- */
- private InternalCache _cache;
-
- private InternalLogWriter logWriter;
-
- /**
- * The GemFire security <code>LogWriter</code>
- */
- private InternalLogWriter securityLogWriter;
-
- /** the maximum number of messages that can be enqueued in a client-queue. */
- private int maximumMessageCount;
-
- /**
- * the time (in seconds) after which a message in the client queue will expire.
- */
- private int messageTimeToLive;
-
- /**
- * A listener which receives notifications about queues that are added or removed
- */
- private ConnectionListener _connectionListener;
-
- private CacheServerStats acceptorStats;
-
- /**
- * haContainer can hold either the name of the client-messages-region (in case of eviction
- * policies "mem" or "entry") or an instance of HashMap (in case of eviction policy "none"). In
- * both the cases, it'll store HAEventWrapper as its key and ClientUpdateMessage as its value.
- */
- private volatile HAContainerWrapper haContainer;
-
- /**
- * The size of the server-to-client communication socket buffers. This can be modified using the
- * BridgeServer.SOCKET_BUFFER_SIZE system property.
- */
- static final private int socketBufferSize =
- Integer.getInteger("BridgeServer.SOCKET_BUFFER_SIZE", 32768).intValue();
-
- /**
- * The statistics for this notifier
- */
- protected final CacheClientNotifierStats _statistics;
-
- /**
- * The <code>InterestRegistrationListener</code> instances registered in this VM. This is used
- * when modifying the set of listeners.
- */
- private final Set writableInterestRegistrationListeners = new CopyOnWriteArraySet();
-
- /**
- * The <code>InterestRegistrationListener</code> instances registered in this VM. This is used to
- * provide a read-only <code>Set</code> of listeners.
- */
- private final Set readableInterestRegistrationListeners =
- Collections.unmodifiableSet(writableInterestRegistrationListeners);
-
- /**
- * System property name for indicating how much frequently the "Queue full" message should be
- * logged.
- */
- public static final String MAX_QUEUE_LOG_FREQUENCY =
- DistributionConfig.GEMFIRE_PREFIX + "logFrequency.clientQueueReachedMaxLimit";
-
- public static final long DEFAULT_LOG_FREQUENCY = 1000;
-
- public static final String EVENT_ENQUEUE_WAIT_TIME_NAME =
- DistributionConfig.GEMFIRE_PREFIX + "subscription.EVENT_ENQUEUE_WAIT_TIME";
-
- public static final int DEFAULT_EVENT_ENQUEUE_WAIT_TIME = 100;
-
- /**
- * System property value denoting the time in milliseconds. Any thread putting an event into a
- * subscription queue, which is full, will wait this much time for the queue to make space. It'll
- * then enque the event possibly causing the queue to grow beyond its capacity/max-size. See
- * #51400.
- */
- public static int eventEnqueueWaitTime;
-
- /**
- * The frequency of logging the "Queue full" message.
- */
- private long logFrequency = DEFAULT_LOG_FREQUENCY;
-
- private final ConcurrentHashMap<String, DefaultQuery> compiledQueries =
- new ConcurrentHashMap<String, DefaultQuery>();
-
- private volatile boolean isCompiledQueryCleanupThreadStarted = false;
-
- private final Object lockIsCompiledQueryCleanupThreadStarted = new Object();
-
- private SystemTimer.SystemTimerTask clientPingTask;
-
- private final SocketCloser socketCloser;
-
- private static final long CLIENT_PING_TASK_PERIOD =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingPeriod", 60000);
-
- private static final long CLIENT_PING_TASK_COUNTER =
- Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "serverToClientPingCounter", 3);
-
public long getLogFrequency() {
return this.logFrequency;
}
@@ -2291,64 +2122,153 @@ public class CacheClientNotifier {
* @return the haContainer
*/
public Map getHaContainer() {
- return haContainer;
+ return this.haContainer;
}
- public void initHaContainer(List overflowAttributesList) {
+ private void initHaContainer(List overflowAttributesList) {
// lazily initialize haContainer in case this CCN instance was created by a gateway receiver
if (overflowAttributesList != null
&& !HARegionQueue.HA_EVICTION_POLICY_NONE.equals(overflowAttributesList.get(0))) {
- haContainer = new HAContainerRegion(_cache.getRegion(Region.SEPARATOR
- + CacheServerImpl.clientMessagesRegion(_cache, (String) overflowAttributesList.get(0),
- ((Integer) overflowAttributesList.get(1)).intValue(),
- ((Integer) overflowAttributesList.get(2)).intValue(),
+ this.haContainer = new HAContainerRegion(this.cache.getRegion(Region.SEPARATOR
+ + CacheServerImpl.clientMessagesRegion(this.cache, (String) overflowAttributesList.get(0),
+ (Integer) overflowAttributesList.get(1), (Integer) overflowAttributesList.get(2),
(String) overflowAttributesList.get(3), (Boolean) overflowAttributesList.get(4))));
} else {
- haContainer = new HAContainerMap(new ConcurrentHashMap());
+ this.haContainer = new HAContainerMap(new ConcurrentHashMap());
}
- assert haContainer != null;
+ assert this.haContainer != null;
if (logger.isDebugEnabled()) {
- logger.debug("ha container ({}) has been created.", haContainer.getName());
+ logger.debug("ha container ({}) has been created.", this.haContainer.getName());
}
}
- private final Set blackListedClients = new CopyOnWriteArraySet();
-
- public void addToBlacklistedClient(ClientProxyMembershipID proxyID) {
- blackListedClients.add(proxyID);
+ void addToBlacklistedClient(ClientProxyMembershipID proxyID) {
+ this.blackListedClients.add(proxyID);
// ensure that cache and distributed system state are current and open
- this.getCache();
+ getCache();
new ScheduledThreadPoolExecutor(1).schedule(new ExpireBlackListTask(proxyID), 120,
TimeUnit.SECONDS);
}
- public Set getBlacklistedClient() {
- return blackListedClients;
+ Set getBlacklistedClient() {
+ return this.blackListedClients;
}
/**
- * @param _cache the _cache to set
+ * @param cache the cache to set
*/
- private void setCache(InternalCache _cache) {
- this._cache = _cache;
+ private void setCache(InternalCache cache) {
+ this.cache = cache;
}
+ /**
+ * Non-static inner class ExpireBlackListTask
+ */
private class ExpireBlackListTask extends PoolTask {
- private ClientProxyMembershipID proxyID;
+ private final ClientProxyMembershipID proxyID;
- public ExpireBlackListTask(ClientProxyMembershipID proxyID) {
+ ExpireBlackListTask(ClientProxyMembershipID proxyID) {
this.proxyID = proxyID;
}
@Override
public void run2() {
- if (blackListedClients.remove(proxyID)) {
+ if (blackListedClients.remove(this.proxyID)) {
if (logger.isDebugEnabled()) {
- logger.debug("{} client is no longer blacklisted", proxyID);
+ logger.debug("{} client is no longer blacklisted", this.proxyID);
}
}
}
}
+
+ /**
+ * Static inner-class ServerInterestRegistrationMessage
+ * <p>
+ * this message is used to send interest registration to another server. Since interest
+ * registration performs a state-flush operation this message must not transmitted on an ordered
+ * socket
+ */
+ public static class ServerInterestRegistrationMessage extends HighPriorityDistributionMessage
+ implements MessageWithReply {
+
+ ClientProxyMembershipID clientId;
+ ClientInterestMessageImpl clientMessage;
+ int processorId;
+
+ ServerInterestRegistrationMessage(ClientProxyMembershipID clientID,
+ ClientInterestMessageImpl msg) {
+ this.clientId = clientID;
+ this.clientMessage = msg;
+ }
+
+ public ServerInterestRegistrationMessage() {
+ // nothing
+ }
+
+ static void sendInterestChange(DM dm, ClientProxyMembershipID clientID,
+ ClientInterestMessageImpl msg) {
+ ServerInterestRegistrationMessage registrationMessage =
+ new ServerInterestRegistrationMessage(clientID, msg);
+ Set recipients = dm.getOtherDistributionManagerIds();
+ registrationMessage.setRecipients(recipients);
+ ReplyProcessor21 rp = new ReplyProcessor21(dm, recipients);
+ registrationMessage.processorId = rp.getProcessorId();
+ dm.putOutgoing(registrationMessage);
+ try {
+ rp.waitForReplies();
+ } catch (InterruptedException ignore) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ @Override
+ protected void process(DistributionManager dm) {
+ // Get the proxy for the proxy id
+ try {
+ CacheClientNotifier clientNotifier = CacheClientNotifier.getInstance();
+ if (clientNotifier != null) {
+ CacheClientProxy proxy = clientNotifier.getClientProxy(this.clientId);
+ // If this VM contains a proxy for the requested proxy id, forward the
+ // message on to the proxy f
<TRUNCATED>
[23/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GatewayReceiverCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GatewayReceiverCommand.java
index d44a4ad..704f2da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GatewayReceiverCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GatewayReceiverCommand.java
@@ -79,14 +79,14 @@ public class GatewayReceiverCommand extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
String regionName = null;
Object callbackArg = null, key = null;
int partNumber = 0;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- GatewayReceiverStats stats = (GatewayReceiverStats) servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ GatewayReceiverStats stats = (GatewayReceiverStats) serverConnection.getCacheServerStats();
EventID eventId = null;
LocalRegion region = null;
List<BatchException70> exceptions = new ArrayList<BatchException70>();
@@ -102,20 +102,20 @@ public class GatewayReceiverCommand extends BaseCommand {
// statement so that all messages can take advantage of it.
boolean earlyAck = false;// msg.getEarlyAck();
- stats.incBatchSize(msg.getPayloadLength());
+ stats.incBatchSize(clientMessage.getPayloadLength());
// Retrieve the number of events
- Part numberOfEventsPart = msg.getPart(0);
+ Part numberOfEventsPart = clientMessage.getPart(0);
int numberOfEvents = numberOfEventsPart.getInt();
stats.incEventsReceived(numberOfEvents);
// Retrieve the batch id
- Part batchIdPart = msg.getPart(1);
+ Part batchIdPart = clientMessage.getPart(1);
int batchId = batchIdPart.getInt();
// If this batch has already been seen, do not reply.
// Instead, drop the batch and continue.
- if (batchId <= servConn.getLatestBatchIdReplied()) {
+ if (batchId <= serverConnection.getLatestBatchIdReplied()) {
if (GatewayReceiver.APPLY_RETRIES) {
// Do nothing!!!
logger.warn(LocalizedMessage.create(
@@ -125,17 +125,17 @@ public class GatewayReceiverCommand extends BaseCommand {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_RECEIVED_PROCESS_BATCH_REQUEST_0_THAT_HAS_ALREADY_BEEN_OR_IS_BEING_PROCESSED__THIS_PROCESS_BATCH_REQUEST_IS_BEING_IGNORED,
batchId));
- writeReply(msg, servConn, batchId, numberOfEvents);
+ writeReply(clientMessage, serverConnection, batchId, numberOfEvents);
return;
}
stats.incDuplicateBatchesReceived();
}
// Verify the batches arrive in order
- if (batchId != servConn.getLatestBatchIdReplied() + 1) {
+ if (batchId != serverConnection.getLatestBatchIdReplied() + 1) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_RECEIVED_PROCESS_BATCH_REQUEST_0_OUT_OF_ORDER_THE_ID_OF_THE_LAST_BATCH_PROCESSED_WAS_1_THIS_BATCH_REQUEST_WILL_BE_PROCESSED_BUT_SOME_MESSAGES_MAY_HAVE_BEEN_LOST,
- new Object[] {batchId, servConn.getLatestBatchIdReplied()}));
+ new Object[] {batchId, serverConnection.getLatestBatchIdReplied()}));
stats.incOutoforderBatchesReceived();
}
@@ -146,7 +146,7 @@ public class GatewayReceiverCommand extends BaseCommand {
// If early ack mode, acknowledge right away
// Not sure if earlyAck makes sense with sliding window
if (earlyAck) {
- servConn.incrementLatestBatchIdReplied(batchId);
+ serverConnection.incrementLatestBatchIdReplied(batchId);
// writeReply(msg, servConn);
// servConn.setAsTrue(RESPONDED);
@@ -162,13 +162,13 @@ public class GatewayReceiverCommand extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received process batch request {} containing {} events ({} bytes) with {} acknowledgement on {}",
- servConn.getName(), batchId, numberOfEvents, msg.getPayloadLength(),
- (earlyAck ? "early" : "normal"), servConn.getSocketString());
+ serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(),
+ (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
if (earlyAck) {
logger.debug(
"{}: Sent process batch early response for batch {} containing {} events ({} bytes) with {} acknowledgement on {}",
- servConn.getName(), batchId, numberOfEvents, msg.getPayloadLength(),
- (earlyAck ? "early" : "normal"), servConn.getSocketString());
+ serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(),
+ (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
}
}
// logger.warn("Received process batch request " + batchId + " containing
@@ -185,10 +185,10 @@ public class GatewayReceiverCommand extends BaseCommand {
// Retrieve the events from the message parts. The '2' below
// represents the number of events (part0) and the batchId (part1)
partNumber = 2;
- int dsid = msg.getPart(partNumber++).getInt();
+ int dsid = clientMessage.getPart(partNumber++).getInt();
boolean removeOnException =
- msg.getPart(partNumber++).getSerializedForm()[0] == 1 ? true : false;
+ clientMessage.getPart(partNumber++).getSerializedForm()[0] == 1 ? true : false;
// Keep track of whether a response has been written for
// exceptions
@@ -202,7 +202,7 @@ public class GatewayReceiverCommand extends BaseCommand {
indexWithoutPDXEvent++;
// System.out.println("Processing event " + i + " in batch " + batchId + "
// starting with part number " + partNumber);
- Part actionTypePart = msg.getPart(partNumber);
+ Part actionTypePart = clientMessage.getPart(partNumber);
int actionType = actionTypePart.getInt();
long versionTimeStamp = VersionTag.ILLEGAL_VERSION_TIMESTAMP;
@@ -211,14 +211,15 @@ public class GatewayReceiverCommand extends BaseCommand {
boolean callbackArgExists = false;
try {
- Part possibleDuplicatePart = msg.getPart(partNumber + 1);
+ Part possibleDuplicatePart = clientMessage.getPart(partNumber + 1);
byte[] possibleDuplicatePartBytes;
try {
possibleDuplicatePartBytes = (byte[]) possibleDuplicatePart.getObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
@@ -231,7 +232,7 @@ public class GatewayReceiverCommand extends BaseCommand {
callbackArg = null;
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(partNumber + 2);
+ regionNamePart = clientMessage.getPart(partNumber + 2);
regionName = regionNamePart.getString();
if (regionName.equals(PeerTypeRegistration.REGION_FULL_PATH)) {
indexWithoutPDXEvent--;
@@ -243,28 +244,30 @@ public class GatewayReceiverCommand extends BaseCommand {
// duplication of events, but it is unused now. In
// fact the event id is overridden by the FROM_GATEWAY
// token.
- Part eventIdPart = msg.getPart(partNumber + 3);
- eventIdPart.setVersion(servConn.getClientVersion());
+ Part eventIdPart = clientMessage.getPart(partNumber + 3);
+ eventIdPart.setVersion(serverConnection.getClientVersion());
// String eventId = eventIdPart.getString();
try {
eventId = (EventID) eventIdPart.getObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
}
// Retrieve the key from the message parts
- keyPart = msg.getPart(partNumber + 4);
+ keyPart = clientMessage.getPart(partNumber + 4);
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
@@ -281,7 +284,7 @@ public class GatewayReceiverCommand extends BaseCommand {
*/
// Retrieve the value from the message parts (do not deserialize it)
- valuePart = msg.getPart(partNumber + 5);
+ valuePart = clientMessage.getPart(partNumber + 5);
// try {
// logger.warn(getName() + ": Creating key " + key + " value " +
// valuePart.getObject());
@@ -289,18 +292,19 @@ public class GatewayReceiverCommand extends BaseCommand {
// Retrieve the callbackArg from the message parts if necessary
int index = partNumber + 6;
- callbackArgExistsPart = msg.getPart(index++); {
+ callbackArgExistsPart = clientMessage.getPart(index++); {
byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
callbackArgExists = partBytes[0] == 0x01;
}
if (callbackArgExists) {
- callbackArgPart = msg.getPart(index++);
+ callbackArgPart = clientMessage.getPart(index++);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_CREATE_REQUEST_1_FOR_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
@@ -309,14 +313,14 @@ public class GatewayReceiverCommand extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Processing batch create request {} on {} for region {} key {} value {} callbackArg {}, eventId={}",
- servConn.getName(), batchId, servConn.getSocketString(), regionName, key,
+ serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key,
valuePart, callbackArg, eventId);
}
- versionTimeStamp = msg.getPart(index++).getLong();
+ versionTimeStamp = clientMessage.getPart(index++).getLong();
// Process the create request
if (key == null || regionName == null) {
StringId message = null;
- Object[] messageArgs = new Object[] {servConn.getName(), Integer.valueOf(batchId)};
+ Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId)};
if (key == null) {
message =
LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_CREATE_REQUEST_1_IS_NULL;
@@ -331,7 +335,7 @@ public class GatewayReceiverCommand extends BaseCommand {
}
region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
- handleRegionNull(servConn, regionName, batchId);
+ handleRegionNull(serverConnection, regionName, batchId);
} else {
clientEvent = new EventIDHolder(eventId);
if (versionTimeStamp > 0) {
@@ -348,7 +352,7 @@ public class GatewayReceiverCommand extends BaseCommand {
boolean isObject = valuePart.isObject();
// [sumedh] This should be done on client while sending
// since that is the WAN gateway
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
PutOperationContext putContext =
authzRequest.putAuthorize(regionName, key, value, isObject, callbackArg);
@@ -361,29 +365,31 @@ public class GatewayReceiverCommand extends BaseCommand {
result = addPdxType(crHelper, key, value);
} else {
result = region.basicBridgeCreate(key, value, isObject, callbackArg,
- servConn.getProxyID(), false, clientEvent, false);
+ serverConnection.getProxyID(), false, clientEvent, false);
// If the create fails (presumably because it already exists),
// attempt to update the entry
if (!result) {
result = region.basicBridgePut(key, value, null, isObject, callbackArg,
- servConn.getProxyID(), false, clientEvent);
+ serverConnection.getProxyID(), false, clientEvent);
}
}
if (result || clientEvent.isConcurrencyConflict()) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
stats.incCreateRequest();
} else {
// This exception will be logged in the catch block below
throw new Exception(
LocalizedStrings.ProcessBatch_0_FAILED_TO_CREATE_OR_UPDATE_ENTRY_FOR_REGION_1_KEY_2_VALUE_3_CALLBACKARG_4
- .toLocalizedString(new Object[] {servConn.getName(), regionName, key,
+ .toLocalizedString(new Object[] {
+ serverConnection.getName(), regionName, key,
valuePart, callbackArg}));
}
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_CREATE_REQUEST_1_FOR_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
@@ -400,7 +406,7 @@ public class GatewayReceiverCommand extends BaseCommand {
*/
// Retrieve the value from the message parts (do not deserialize it)
- valuePart = msg.getPart(partNumber + 5);
+ valuePart = clientMessage.getPart(partNumber + 5);
// try {
// logger.warn(getName() + ": Updating key " + key + " value " +
// valuePart.getObject());
@@ -408,34 +414,35 @@ public class GatewayReceiverCommand extends BaseCommand {
// Retrieve the callbackArg from the message parts if necessary
index = partNumber + 6;
- callbackArgExistsPart = msg.getPart(index++); {
+ callbackArgExistsPart = clientMessage.getPart(index++); {
byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
callbackArgExists = partBytes[0] == 0x01;
}
if (callbackArgExists) {
- callbackArgPart = msg.getPart(index++);
+ callbackArgPart = clientMessage.getPart(index++);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
}
}
- versionTimeStamp = msg.getPart(index++).getLong();
+ versionTimeStamp = clientMessage.getPart(index++).getLong();
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Processing batch update request {} on {} for region {} key {} value {} callbackArg {}",
- servConn.getName(), batchId, servConn.getSocketString(), regionName, key,
+ serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key,
valuePart, callbackArg);
}
// Process the update request
if (key == null || regionName == null) {
StringId message = null;
- Object[] messageArgs = new Object[] {servConn.getName(), Integer.valueOf(batchId)};
+ Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId)};
if (key == null) {
message =
LocalizedStrings.ProcessBatch_0_THE_INPUT_KEY_FOR_THE_BATCH_UPDATE_REQUEST_1_IS_NULL;
@@ -450,7 +457,7 @@ public class GatewayReceiverCommand extends BaseCommand {
}
region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
- handleRegionNull(servConn, regionName, batchId);
+ handleRegionNull(serverConnection, regionName, batchId);
} else {
clientEvent = new EventIDHolder(eventId);
if (versionTimeStamp > 0) {
@@ -465,7 +472,7 @@ public class GatewayReceiverCommand extends BaseCommand {
try {
byte[] value = valuePart.getSerializedForm();
boolean isObject = valuePart.isObject();
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
PutOperationContext putContext = authzRequest.putAuthorize(regionName, key, value,
isObject, callbackArg, PutOperationContext.UPDATE);
@@ -477,14 +484,14 @@ public class GatewayReceiverCommand extends BaseCommand {
result = addPdxType(crHelper, key, value);
} else {
result = region.basicBridgePut(key, value, null, isObject, callbackArg,
- servConn.getProxyID(), false, clientEvent);
+ serverConnection.getProxyID(), false, clientEvent);
}
if (result || clientEvent.isConcurrencyConflict()) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
stats.incUpdateRequest();
} else {
final Object[] msgArgs =
- new Object[] {servConn.getName(), regionName, key, valuePart, callbackArg};
+ new Object[] { serverConnection.getName(), regionName, key, valuePart, callbackArg};
final StringId message =
LocalizedStrings.ProcessBatch_0_FAILED_TO_UPDATE_ENTRY_FOR_REGION_1_KEY_2_VALUE_3_AND_CALLBACKARG_4;
String s = message.toLocalizedString(msgArgs);
@@ -493,16 +500,16 @@ public class GatewayReceiverCommand extends BaseCommand {
}
} catch (CancelException e) {
// FIXME better exception hierarchy would avoid this check
- if (servConn.getCachedRegionHelper().getCache().getCancelCriterion()
- .isCancelInProgress()) {
+ if (serverConnection.getCachedRegionHelper().getCache().getCancelCriterion()
+ .isCancelInProgress()) {
if (logger.isDebugEnabled()) {
logger.debug(
"{} ignoring message of type {} from client {} because shutdown occurred during message processing.",
- servConn.getName(), MessageType.getString(msg.getMessageType()),
- servConn.getProxyID());
+ serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
+ serverConnection.getProxyID());
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
} else {
throw e;
}
@@ -511,7 +518,8 @@ public class GatewayReceiverCommand extends BaseCommand {
// Preserve the connection under all circumstances
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
@@ -521,28 +529,29 @@ public class GatewayReceiverCommand extends BaseCommand {
case 2: // Destroy
// Retrieve the callbackArg from the message parts if necessary
index = partNumber + 5;
- callbackArgExistsPart = msg.getPart(index++); {
+ callbackArgExistsPart = clientMessage.getPart(index++); {
byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
callbackArgExists = partBytes[0] == 0x01;
}
if (callbackArgExists) {
- callbackArgPart = msg.getPart(index++);
+ callbackArgPart = clientMessage.getPart(index++);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_DESTROY_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
}
}
- versionTimeStamp = msg.getPart(index++).getLong();
+ versionTimeStamp = clientMessage.getPart(index++).getLong();
if (logger.isDebugEnabled()) {
logger.debug("{}: Processing batch destroy request {} on {} for region {} key {}",
- servConn.getName(), batchId, servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key);
}
// Process the destroy request
@@ -556,14 +565,14 @@ public class GatewayReceiverCommand extends BaseCommand {
message =
LocalizedStrings.ProcessBatch_0_THE_INPUT_REGION_NAME_FOR_THE_BATCH_DESTROY_REQUEST_1_IS_NULL;
}
- Object[] messageArgs = new Object[] {servConn.getName(), Integer.valueOf(batchId)};
+ Object[] messageArgs = new Object[] { serverConnection.getName(), Integer.valueOf(batchId)};
String s = message.toLocalizedString(messageArgs);
logger.warn(s);
throw new Exception(s);
}
region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
- handleRegionNull(servConn, regionName, batchId);
+ handleRegionNull(serverConnection, regionName, batchId);
} else {
clientEvent = new EventIDHolder(eventId);
if (versionTimeStamp > 0) {
@@ -576,20 +585,20 @@ public class GatewayReceiverCommand extends BaseCommand {
handleMessageRetry(region, clientEvent);
// Destroy the entry
try {
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
DestroyOperationContext destroyContext =
authzRequest.destroyAuthorize(regionName, key, callbackArg);
callbackArg = destroyContext.getCallbackArg();
}
- region.basicBridgeDestroy(key, callbackArg, servConn.getProxyID(), false,
+ region.basicBridgeDestroy(key, callbackArg, serverConnection.getProxyID(), false,
clientEvent);
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
stats.incDestroyRequest();
} catch (EntryNotFoundException e) {
logger.info(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_DURING_BATCH_DESTROY_NO_ENTRY_WAS_FOUND_FOR_KEY_1,
- new Object[] {servConn.getName(), key}));
+ new Object[] { serverConnection.getName(), key}));
// throw new Exception(e);
}
}
@@ -598,43 +607,44 @@ public class GatewayReceiverCommand extends BaseCommand {
try {
// Region name
- regionNamePart = msg.getPart(partNumber + 2);
+ regionNamePart = clientMessage.getPart(partNumber + 2);
regionName = regionNamePart.getString();
// Retrieve the event id from the message parts
- eventIdPart = msg.getPart(partNumber + 3);
+ eventIdPart = clientMessage.getPart(partNumber + 3);
eventId = (EventID) eventIdPart.getObject();
// Retrieve the key from the message parts
- keyPart = msg.getPart(partNumber + 4);
+ keyPart = clientMessage.getPart(partNumber + 4);
key = keyPart.getStringOrObject();
// Retrieve the callbackArg from the message parts if necessary
index = partNumber + 5;
- callbackArgExistsPart = msg.getPart(index++);
+ callbackArgExistsPart = clientMessage.getPart(index++);
byte[] partBytes = (byte[]) callbackArgExistsPart.getObject();
callbackArgExists = partBytes[0] == 0x01;
if (callbackArgExists) {
- callbackArgPart = msg.getPart(index++);
+ callbackArgPart = clientMessage.getPart(index++);
callbackArg = callbackArgPart.getObject();
}
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_VERSION_REQUEST_1_CONTAINING_2_EVENTS,
- new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)}),
e);
throw e;
}
- versionTimeStamp = msg.getPart(index++).getLong();
+ versionTimeStamp = clientMessage.getPart(index++).getLong();
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Processing batch update-version request {} on {} for region {} key {} value {} callbackArg {}",
- servConn.getName(), batchId, servConn.getSocketString(), regionName, key,
+ serverConnection.getName(), batchId, serverConnection.getSocketString(), regionName, key,
valuePart, callbackArg);
}
// Process the update time-stamp request
@@ -642,7 +652,8 @@ public class GatewayReceiverCommand extends BaseCommand {
StringId message =
LocalizedStrings.ProcessBatch_0_CAUGHT_EXCEPTION_PROCESSING_BATCH_UPDATE_VERSION_REQUEST_1_CONTAINING_2_EVENTS;
- Object[] messageArgs = new Object[] {servConn.getName(), Integer.valueOf(batchId),
+ Object[] messageArgs = new Object[] {
+ serverConnection.getName(), Integer.valueOf(batchId),
Integer.valueOf(numberOfEvents)};
String s = message.toLocalizedString(messageArgs);
logger.warn(s);
@@ -652,7 +663,7 @@ public class GatewayReceiverCommand extends BaseCommand {
region = (LocalRegion) crHelper.getRegion(regionName);
if (region == null) {
- handleRegionNull(servConn, regionName, batchId);
+ handleRegionNull(serverConnection, regionName, batchId);
} else {
clientEvent = new EventIDHolder(eventId);
@@ -668,13 +679,13 @@ public class GatewayReceiverCommand extends BaseCommand {
// Update the version tag
try {
- region.basicBridgeUpdateVersionStamp(key, callbackArg, servConn.getProxyID(),
+ region.basicBridgeUpdateVersionStamp(key, callbackArg, serverConnection.getProxyID(),
false, clientEvent);
} catch (EntryNotFoundException e) {
logger.info(LocalizedMessage.create(
LocalizedStrings.ProcessBatch_0_DURING_BATCH_UPDATE_VERSION_NO_ENTRY_WAS_FOUND_FOR_KEY_1,
- new Object[] {servConn.getName(), key}));
+ new Object[] { serverConnection.getName(), key}));
// throw new Exception(e);
}
}
@@ -684,29 +695,30 @@ public class GatewayReceiverCommand extends BaseCommand {
default:
logger.fatal(LocalizedMessage.create(
LocalizedStrings.Processbatch_0_UNKNOWN_ACTION_TYPE_1_FOR_BATCH_FROM_2,
- new Object[] {servConn.getName(), Integer.valueOf(actionType),
- servConn.getSocketString()}));
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(actionType),
+ serverConnection.getSocketString()}));
stats.incUnknowsOperationsReceived();
}
} catch (CancelException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"{} ignoring message of type {} from client {} because shutdown occurred during message processing.",
- servConn.getName(), MessageType.getString(msg.getMessageType()),
- servConn.getProxyID());
+ serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
+ serverConnection.getProxyID());
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
return;
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If we have an issue with the PDX registry, stop processing more data
if (e.getCause() instanceof PdxRegistryMismatchException) {
fatalException = e.getCause();
logger.fatal(LocalizedMessage.create(LocalizedStrings.GatewayReceiver_PDX_CONFIGURATION,
- new Object[] {servConn.getMembershipID()}), e.getCause());
+ new Object[] { serverConnection.getMembershipID()}), e.getCause());
break;
}
@@ -772,26 +784,26 @@ public class GatewayReceiverCommand extends BaseCommand {
stats.incProcessBatchTime(start - oldStart);
}
if (fatalException != null) {
- servConn.incrementLatestBatchIdReplied(batchId);
- writeFatalException(msg, fatalException, servConn, batchId);
- servConn.setAsTrue(RESPONDED);
+ serverConnection.incrementLatestBatchIdReplied(batchId);
+ writeFatalException(clientMessage, fatalException, serverConnection, batchId);
+ serverConnection.setAsTrue(RESPONDED);
} else if (!exceptions.isEmpty()) {
- servConn.incrementLatestBatchIdReplied(batchId);
- writeBatchException(msg, exceptions, servConn, batchId);
- servConn.setAsTrue(RESPONDED);
+ serverConnection.incrementLatestBatchIdReplied(batchId);
+ writeBatchException(clientMessage, exceptions, serverConnection, batchId);
+ serverConnection.setAsTrue(RESPONDED);
} else if (!wroteResponse) {
// Increment the batch id unless the received batch id is -1 (a failover
// batch)
- servConn.incrementLatestBatchIdReplied(batchId);
+ serverConnection.incrementLatestBatchIdReplied(batchId);
- writeReply(msg, servConn, batchId, numberOfEvents);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection, batchId, numberOfEvents);
+ serverConnection.setAsTrue(RESPONDED);
stats.incWriteProcessBatchResponseTime(DistributionStats.getStatTime() - start);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sent process batch normal response for batch {} containing {} events ({} bytes) with {} acknowledgement on {}",
- servConn.getName(), batchId, numberOfEvents, msg.getPayloadLength(),
- (earlyAck ? "early" : "normal"), servConn.getSocketString());
+ serverConnection.getName(), batchId, numberOfEvents, clientMessage.getPayloadLength(),
+ (earlyAck ? "early" : "normal"), serverConnection.getSocketString());
}
// logger.warn("Sent process batch normal response for batch " +
// batchId + " containing " + numberOfEvents + " events (" +
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Get70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Get70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Get70.java
index 5cb1e41..7017aa8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Get70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Get70.java
@@ -54,17 +54,17 @@ public class Get70 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long startparam)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startparam)
throws IOException {
long start = startparam;
Part regionNamePart = null, keyPart = null, valuePart = null;
String regionName = null;
Object callbackArg = null, key = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
StringId errMessage = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// requiresResponse = true;
{
long oldStart = start;
@@ -72,18 +72,18 @@ public class Get70 extends BaseCommand {
stats.incReadGetRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- int parts = msg.getNumberOfParts();
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
+ int parts = clientMessage.getNumberOfParts();
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
// valuePart = null; (redundant assignment)
if (parts > 2) {
- valuePart = msg.getPart(2);
+ valuePart = clientMessage.getPart(2);
try {
callbackArg = valuePart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
// responded = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -91,15 +91,15 @@ public class Get70 extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
// responded = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received 7.0 get request ({} bytes) from {} for region {} key {} txId {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key,
- msg.getTransactionId());
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key,
+ clientMessage.getTransactionId());
}
// Process the get request
@@ -113,18 +113,18 @@ public class Get70 extends BaseCommand {
errMessage = LocalizedStrings.Request_THE_INPUT_REGION_NAME_FOR_THE_GET_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeErrorResponse(msg, MessageType.REQUESTDATAERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeErrorResponse(clientMessage, MessageType.REQUESTDATAERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Region region = servConn.getCache().getRegion(regionName);
+ Region region = serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.Request__0_WAS_NOT_FOUND_DURING_GET_REQUEST
.toLocalizedString(regionName);
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -133,14 +133,14 @@ public class Get70 extends BaseCommand {
// for integrated security
this.securityService.authorizeRegionRead(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
getContext = authzRequest.getAuthorize(regionName, key, callbackArg);
callbackArg = getContext.getCallbackArg();
}
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -148,10 +148,10 @@ public class Get70 extends BaseCommand {
// the value if it is a byte[].
Entry entry;
try {
- entry = getEntry(region, key, callbackArg, servConn);
+ entry = getEntry(region, key, callbackArg, serverConnection);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -164,7 +164,7 @@ public class Get70 extends BaseCommand {
boolean keyNotPresent = entry.keyNotPresent;
try {
- AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest();
+ AuthorizeRequestPP postAuthzRequest = serverConnection.getPostAuthzRequest();
if (postAuthzRequest != null) {
try {
getContext = postAuthzRequest.getAuthorize(regionName, key, data, isObject, getContext);
@@ -182,8 +182,8 @@ public class Get70 extends BaseCommand {
}
}
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -197,23 +197,23 @@ public class Get70 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeResponseWithRefreshMetadata(data, callbackArg, msg, isObject, servConn, pr,
+ writeResponseWithRefreshMetadata(data, callbackArg, clientMessage, isObject, serverConnection, pr,
pr.getNetworkHopType(), versionTag, keyNotPresent);
pr.clearNetworkHopData();
} else {
- writeResponse(data, callbackArg, msg, isObject, versionTag, keyNotPresent, servConn);
+ writeResponse(data, callbackArg, clientMessage, isObject, versionTag, keyNotPresent, serverConnection);
}
} else {
- writeResponse(data, callbackArg, msg, isObject, versionTag, keyNotPresent, servConn);
+ writeResponse(data, callbackArg, clientMessage, isObject, versionTag, keyNotPresent, serverConnection);
}
} finally {
OffHeapHelper.release(originalData);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Wrote get response back to {} for region {} {}", servConn.getName(),
- servConn.getSocketString(), regionName, entry);
+ logger.debug("{}: Wrote get response back to {} for region {} {}", serverConnection.getName(),
+ serverConnection.getSocketString(), regionName, entry);
}
stats.incWriteGetResponseTime(DistributionStats.getStatTime() - start);
@@ -379,12 +379,12 @@ public class Get70 extends BaseCommand {
}
@Override
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
throw new UnsupportedOperationException();
}
@Override
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
throw new UnsupportedOperationException();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll.java
index 22e63c6..5f7cb29 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll.java
@@ -44,33 +44,33 @@ public class GetAll extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keysPart = null;
String regionName = null;
Object[] keys = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
// Retrieve the keys array from the message parts
- keysPart = msg.getPart(1);
+ keysPart = clientMessage.getPart(1);
try {
keys = (Object[]) keysPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
StringBuffer buffer = new StringBuffer();
- buffer.append(servConn.getName()).append(": Received getAll request (")
- .append(msg.getPayloadLength()).append(" bytes) from ").append(servConn.getSocketString())
- .append(" for region ").append(regionName).append(" keys ");
+ buffer.append(serverConnection.getName()).append(": Received getAll request (")
+ .append(clientMessage.getPayloadLength()).append(" bytes) from ").append(serverConnection.getSocketString())
+ .append(" for region ").append(regionName).append(" keys ");
if (keys != null) {
for (int i = 0; i < keys.length; i++) {
buffer.append(keys[i]).append(" ");
@@ -91,37 +91,37 @@ public class GetAll extends BaseCommand {
message = LocalizedStrings.GetAll_THE_INPUT_REGION_NAME_FOR_THE_GETALL_REQUEST_IS_NULL
.toLocalizedString();
}
- logger.warn("{}: {}", servConn.getName(), message);
- writeChunkedErrorResponse(msg, MessageType.GET_ALL_DATA_ERROR, message, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), message);
+ writeChunkedErrorResponse(clientMessage, MessageType.GET_ALL_DATA_ERROR, message, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during getAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Send header
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendGetAllResponseChunks(region, regionName, keys, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendGetAllResponseChunks(region, regionName, keys, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -142,14 +142,14 @@ public class GetAll extends BaseCommand {
numKeys = allKeys.size();
}
- ObjectPartList values = new ObjectPartList(maximumChunkSize, keys == null);
+ ObjectPartList values = new ObjectPartList(MAXIMUM_CHUNK_SIZE, keys == null);
AuthorizeRequest authzRequest = servConn.getAuthzRequest();
AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest();
Request request = (Request) Request.getCommand();
Object[] valueAndIsObject = new Object[3];
for (int i = 0; i < numKeys; i++) {
// Send the intermediate chunk if necessary
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendGetAllResponseChunk(region, values, false, servConn);
values.clear();
@@ -246,7 +246,7 @@ public class GetAll extends BaseCommand {
ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
+ chunkedResponseMsg.addObjPart(list, false);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sending {} getAll response chunk for region={} values={} chunk=<{}>",
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll651.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll651.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll651.java
index a19d540..b0a1915 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll651.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll651.java
@@ -21,7 +21,6 @@ import java.util.Set;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.operations.GetOperationContext;
import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -45,33 +44,33 @@ public class GetAll651 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keysPart = null;
String regionName = null;
Object[] keys = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
// Retrieve the keys array from the message parts
- keysPart = msg.getPart(1);
+ keysPart = clientMessage.getPart(1);
try {
keys = (Object[]) keysPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
StringBuffer buffer = new StringBuffer();
- buffer.append(servConn.getName()).append(": Received getAll request (")
- .append(msg.getPayloadLength()).append(" bytes) from ").append(servConn.getSocketString())
- .append(" for region ").append(regionName).append(" keys ");
+ buffer.append(serverConnection.getName()).append(": Received getAll request (")
+ .append(clientMessage.getPayloadLength()).append(" bytes) from ").append(serverConnection.getSocketString())
+ .append(" for region ").append(regionName).append(" keys ");
if (keys != null) {
for (int i = 0; i < keys.length; i++) {
buffer.append(keys[i]).append(" ");
@@ -90,37 +89,37 @@ public class GetAll651 extends BaseCommand {
message = LocalizedStrings.GetAll_THE_INPUT_REGION_NAME_FOR_THE_GETALL_REQUEST_IS_NULL
.toLocalizedString();
}
- logger.warn("{}: {}", servConn.getName(), message);
- writeChunkedErrorResponse(msg, MessageType.GET_ALL_DATA_ERROR, message, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), message);
+ writeChunkedErrorResponse(clientMessage, MessageType.GET_ALL_DATA_ERROR, message, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during getAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Send header
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendGetAllResponseChunks(region, regionName, keys, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendGetAllResponseChunks(region, regionName, keys, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -148,7 +147,7 @@ public class GetAll651 extends BaseCommand {
final boolean isDebugEnabled = logger.isDebugEnabled();
for (int i = 0; i < numKeys; i++) {
// Send the intermediate chunk if necessary
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendGetAllResponseChunk(region, values, false, servConn);
values.clear();
@@ -253,7 +252,7 @@ public class GetAll651 extends BaseCommand {
* @param includeKeys if the part list should include the keys
*/
protected ObjectPartList651 getObjectPartsList(boolean includeKeys) {
- ObjectPartList651 values = new ObjectPartList651(maximumChunkSize, includeKeys);
+ ObjectPartList651 values = new ObjectPartList651(MAXIMUM_CHUNK_SIZE, includeKeys);
return values;
}
@@ -262,7 +261,7 @@ public class GetAll651 extends BaseCommand {
ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
+ chunkedResponseMsg.addObjPart(list, false);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sending {} getAll response chunk for region={} values={} chunk=<{}>",
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll70.java
index 154e800..579593f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAll70.java
@@ -23,7 +23,6 @@ import org.apache.geode.cache.operations.GetOperationContext;
import org.apache.geode.cache.operations.internal.GetOperationContextImpl;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -40,7 +39,6 @@ import org.apache.geode.internal.offheap.OffHeapHelper;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.security.AuthorizeRequest;
import org.apache.geode.internal.security.AuthorizeRequestPP;
-import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.security.NotAuthorizedException;
public class GetAll70 extends BaseCommand {
@@ -52,36 +50,36 @@ public class GetAll70 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keysPart = null;
String regionName = null;
Object[] keys = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
int partIdx = 0;
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(partIdx++);
+ regionNamePart = clientMessage.getPart(partIdx++);
regionName = regionNamePart.getString();
// Retrieve the keys array from the message parts
- keysPart = msg.getPart(partIdx++);
+ keysPart = clientMessage.getPart(partIdx++);
try {
keys = (Object[]) keysPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean requestSerializedValues;
- requestSerializedValues = msg.getPart(partIdx++).getInt() == 1;
+ requestSerializedValues = clientMessage.getPart(partIdx++).getInt() == 1;
if (logger.isDebugEnabled()) {
StringBuffer buffer = new StringBuffer();
- buffer.append(servConn.getName()).append(": Received getAll request (")
- .append(msg.getPayloadLength()).append(" bytes) from ").append(servConn.getSocketString())
- .append(" for region ").append(regionName).append(" keys ");
+ buffer.append(serverConnection.getName()).append(": Received getAll request (")
+ .append(clientMessage.getPayloadLength()).append(" bytes) from ").append(serverConnection.getSocketString())
+ .append(" for region ").append(regionName).append(" keys ");
if (keys != null) {
for (int i = 0; i < keys.length; i++) {
buffer.append(keys[i]).append(" ");
@@ -100,37 +98,37 @@ public class GetAll70 extends BaseCommand {
message = LocalizedStrings.GetAll_THE_INPUT_REGION_NAME_FOR_THE_GETALL_REQUEST_IS_NULL
.toLocalizedString();
}
- logger.warn("{}: {}", servConn.getName(), message);
- writeChunkedErrorResponse(msg, MessageType.GET_ALL_DATA_ERROR, message, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), message);
+ writeChunkedErrorResponse(clientMessage, MessageType.GET_ALL_DATA_ERROR, message, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during getAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Send header
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendGetAllResponseChunks(region, regionName, keys, servConn, requestSerializedValues);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendGetAllResponseChunks(region, regionName, keys, serverConnection, requestSerializedValues);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -163,7 +161,7 @@ public class GetAll70 extends BaseCommand {
// in the old mode (which may be impossible since we only used that mode pre 7.0) in which the
// client told us
// to get and return all the keys and values. I think this was used for register interest.
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, keys == null,
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, keys == null,
region.getAttributes().getConcurrencyChecksEnabled(), requestSerializedValues);
try {
AuthorizeRequest authzRequest = servConn.getAuthzRequest();
@@ -172,7 +170,7 @@ public class GetAll70 extends BaseCommand {
final boolean isDebugEnabled = logger.isDebugEnabled();
for (int i = 0; i < numKeys; i++) {
// Send the intermediate chunk if necessary
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
values.setKeys(null);
sendGetAllResponseChunk(region, values, false, servConn);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllForRI.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllForRI.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllForRI.java
index d380beb..43d3348 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllForRI.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllForRI.java
@@ -38,7 +38,7 @@ public class GetAllForRI extends GetAll651 {
@Override
protected ObjectPartList651 getObjectPartsList(boolean includeKeys) {
- return new SerializedObjectPartList(maximumChunkSize, includeKeys);
+ return new SerializedObjectPartList(MAXIMUM_CHUNK_SIZE, includeKeys);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllWithCallback.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllWithCallback.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllWithCallback.java
index 2fb860d..c6663de 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllWithCallback.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetAllWithCallback.java
@@ -22,7 +22,6 @@ import org.apache.geode.cache.Region;
import org.apache.geode.cache.operations.GetOperationContext;
import org.apache.geode.cache.operations.internal.GetOperationContextImpl;
import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -57,44 +56,44 @@ public class GetAllWithCallback extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keysPart = null, callbackPart = null;
String regionName = null;
Object[] keys = null;
Object callback = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
int partIdx = 0;
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(partIdx++);
+ regionNamePart = clientMessage.getPart(partIdx++);
regionName = regionNamePart.getString();
// Retrieve the keys array from the message parts
- keysPart = msg.getPart(partIdx++);
+ keysPart = clientMessage.getPart(partIdx++);
try {
keys = (Object[]) keysPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- callbackPart = msg.getPart(partIdx++);
+ callbackPart = clientMessage.getPart(partIdx++);
try {
callback = callbackPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
StringBuffer buffer = new StringBuffer();
- buffer.append(servConn.getName()).append(": Received getAll request (")
- .append(msg.getPayloadLength()).append(" bytes) from ").append(servConn.getSocketString())
- .append(" for region ").append(regionName).append(" with callback ").append(callback)
- .append(" keys ");
+ buffer.append(serverConnection.getName()).append(": Received getAll request (")
+ .append(clientMessage.getPayloadLength()).append(" bytes) from ").append(serverConnection.getSocketString())
+ .append(" for region ").append(regionName).append(" with callback ").append(callback)
+ .append(" keys ");
if (keys != null) {
for (int i = 0; i < keys.length; i++) {
buffer.append(keys[i]).append(" ");
@@ -114,35 +113,35 @@ public class GetAllWithCallback extends BaseCommand {
.toLocalizedString();
}
logger.warn(LocalizedMessage.create(LocalizedStrings.TWO_ARG_COLON,
- new Object[] {servConn.getName(), message}));
- writeChunkedErrorResponse(msg, MessageType.GET_ALL_DATA_ERROR, message, servConn);
- servConn.setAsTrue(RESPONDED);
+ new Object[] { serverConnection.getName(), message}));
+ writeChunkedErrorResponse(clientMessage, MessageType.GET_ALL_DATA_ERROR, message, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during getAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Send header
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendGetAllResponseChunks(region, regionName, keys, servConn, callback);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendGetAllResponseChunks(region, regionName, keys, serverConnection, callback);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -154,7 +153,7 @@ public class GetAllWithCallback extends BaseCommand {
assert keys != null;
int numKeys = keys.length;
- VersionedObjectList values = new VersionedObjectList(maximumChunkSize, false,
+ VersionedObjectList values = new VersionedObjectList(MAXIMUM_CHUNK_SIZE, false,
region.getAttributes().getConcurrencyChecksEnabled(), false);
try {
AuthorizeRequest authzRequest = servConn.getAuthzRequest();
@@ -162,7 +161,7 @@ public class GetAllWithCallback extends BaseCommand {
Get70 request = (Get70) Get70.getCommand();
for (int i = 0; i < numKeys; i++) {
// Send the intermediate chunk if necessary
- if (values.size() == maximumChunkSize) {
+ if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendGetAllResponseChunk(region, values, false, servConn);
values.clear();
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand.java
index a3e565d..bcdbd08 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand.java
@@ -49,20 +49,19 @@ public class GetClientPRMetadataCommand extends BaseCommand {
private GetClientPRMetadataCommand() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
String regionFullPath = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- regionFullPath = msg.getPart(0).getString();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ regionFullPath = clientMessage.getPart(0).getString();
String errMessage = "";
if (regionFullPath == null) {
logger.warn(LocalizedMessage
.create(LocalizedStrings.GetClientPRMetadata_THE_INPUT_REGION_PATH_IS_NULL));
errMessage =
LocalizedStrings.GetClientPRMetadata_THE_INPUT_REGION_PATH_IS_NULL.toLocalizedString();
- writeErrorResponse(msg, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
Region region = crHelper.getRegion(regionFullPath);
if (region == null) {
@@ -71,13 +70,12 @@ public class GetClientPRMetadataCommand extends BaseCommand {
regionFullPath));
errMessage = LocalizedStrings.GetClientPRMetadata_REGION_NOT_FOUND.toLocalizedString()
+ regionFullPath;
- writeErrorResponse(msg, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
try {
- Message responseMsg = servConn.getResponseMessage();
- responseMsg.setTransactionId(msg.getTransactionId());
+ Message responseMsg = serverConnection.getResponseMessage();
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.setMessageType(MessageType.RESPONSE_CLIENT_PR_METADATA);
PartitionedRegion prRgion = (PartitionedRegion) region;
@@ -93,11 +91,11 @@ public class GetClientPRMetadataCommand extends BaseCommand {
}
}
responseMsg.send();
- msg.clearParts();
+ clientMessage.clearParts();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
} finally {
- servConn.setAsTrue(Command.RESPONDED);
+ serverConnection.setAsTrue(Command.RESPONDED);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand66.java
index 3961b19..4c519a9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPRMetadataCommand66.java
@@ -47,20 +47,19 @@ public class GetClientPRMetadataCommand66 extends BaseCommand {
private GetClientPRMetadataCommand66() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
String regionFullPath = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- regionFullPath = msg.getPart(0).getString();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ regionFullPath = clientMessage.getPart(0).getString();
String errMessage = "";
if (regionFullPath == null) {
logger.warn(LocalizedMessage
.create(LocalizedStrings.GetClientPRMetadata_THE_INPUT_REGION_PATH_IS_NULL));
errMessage =
LocalizedStrings.GetClientPRMetadata_THE_INPUT_REGION_PATH_IS_NULL.toLocalizedString();
- writeErrorResponse(msg, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
Region region = crHelper.getRegion(regionFullPath);
if (region == null) {
@@ -69,13 +68,12 @@ public class GetClientPRMetadataCommand66 extends BaseCommand {
regionFullPath));
errMessage = LocalizedStrings.GetClientPRMetadata_REGION_NOT_FOUND.toLocalizedString()
+ regionFullPath;
- writeErrorResponse(msg, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PR_METADATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
try {
- Message responseMsg = servConn.getResponseMessage();
- responseMsg.setTransactionId(msg.getTransactionId());
+ Message responseMsg = serverConnection.getResponseMessage();
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.setMessageType(MessageType.RESPONSE_CLIENT_PR_METADATA);
PartitionedRegion prRgion = (PartitionedRegion) region;
@@ -86,11 +84,11 @@ public class GetClientPRMetadataCommand66 extends BaseCommand {
responseMsg.addObjPart(serverLocations);
}
responseMsg.send();
- msg.clearParts();
+ clientMessage.clearParts();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
} finally {
- servConn.setAsTrue(Command.RESPONDED);
+ serverConnection.setAsTrue(Command.RESPONDED);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
index 7d5c251..6be9353 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand.java
@@ -45,22 +45,22 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
@SuppressWarnings("unchecked")
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
String regionFullPath = null;
- regionFullPath = msg.getPart(0).getString();
+ regionFullPath = clientMessage.getPart(0).getString();
String errMessage = "";
if (regionFullPath == null) {
logger.warn(LocalizedMessage
.create(LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL));
errMessage = LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL
.toLocalizedString();
- writeErrorResponse(msg, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
- errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+ errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Region region = servConn.getCache().getRegion(regionFullPath);
+ Region region = serverConnection.getCache().getRegion(regionFullPath);
if (region == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
@@ -68,15 +68,15 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
errMessage =
LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND.toLocalizedString()
+ regionFullPath;
- writeErrorResponse(msg, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
- errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+ errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
- Message responseMsg = servConn.getResponseMessage();
- responseMsg.setTransactionId(msg.getTransactionId());
+ Message responseMsg = serverConnection.getResponseMessage();
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
PartitionedRegion prRgion = (PartitionedRegion) region;
@@ -113,11 +113,11 @@ public class GetClientPartitionAttributesCommand extends BaseCommand {
}
responseMsg.addObjPart(leaderRegionPath);
responseMsg.send();
- msg.clearParts();
+ clientMessage.clearParts();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
} finally {
- servConn.setAsTrue(Command.RESPONDED);
+ serverConnection.setAsTrue(Command.RESPONDED);
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
index 209c40c..251f4da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetClientPartitionAttributesCommand66.java
@@ -50,22 +50,22 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
@SuppressWarnings("unchecked")
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
String regionFullPath = null;
- regionFullPath = msg.getPart(0).getString();
+ regionFullPath = clientMessage.getPart(0).getString();
String errMessage = "";
if (regionFullPath == null) {
logger.warn(LocalizedMessage
.create(LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL));
errMessage = LocalizedStrings.GetClientPartitionAttributes_THE_INPUT_REGION_PATH_IS_NULL
.toLocalizedString();
- writeErrorResponse(msg, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
- errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+ errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Region region = servConn.getCache().getRegion(regionFullPath);
+ Region region = serverConnection.getCache().getRegion(regionFullPath);
if (region == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND_FOR_SPECIFIED_REGION_PATH,
@@ -73,15 +73,15 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
errMessage =
LocalizedStrings.GetClientPartitionAttributes_REGION_NOT_FOUND.toLocalizedString()
+ regionFullPath;
- writeErrorResponse(msg, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
- errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.GET_CLIENT_PARTITION_ATTRIBUTES_ERROR,
+ errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
- Message responseMsg = servConn.getResponseMessage();
- responseMsg.setTransactionId(msg.getTransactionId());
+ Message responseMsg = serverConnection.getResponseMessage();
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.setMessageType(MessageType.RESPONSE_CLIENT_PARTITION_ATTRIBUTES);
if (!(region instanceof PartitionedRegion)) {
@@ -138,11 +138,11 @@ public class GetClientPartitionAttributesCommand66 extends BaseCommand {
}
}
responseMsg.send();
- msg.clearParts();
+ clientMessage.clearParts();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
} finally {
- servConn.setAsTrue(Command.RESPONDED);
+ serverConnection.setAsTrue(Command.RESPONDED);
}
}
[27/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
Cleanup BaseCommand
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/db81427f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/db81427f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/db81427f
Branch: refs/heads/feature/GEODE-2632-16
Commit: db81427fd44e3e8dc6594678a20bde0f2d71ce72
Parents: f43c778
Author: Kirk Lund <kl...@apache.org>
Authored: Fri May 19 14:57:20 2017 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri May 19 14:58:25 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/geode/GemFireException.java | 93 +--
.../org/apache/geode/cache/CacheException.java | 14 +-
.../geode/cache/CacheRuntimeException.java | 15 +-
.../org/apache/geode/internal/DSFIDFactory.java | 2 +-
.../geode/internal/cache/PartitionedRegion.java | 3 +-
.../geode/internal/cache/ha/HARegionQueue.java | 157 ++--
.../geode/internal/cache/tier/Command.java | 17 +-
.../cache/tier/sockets/BaseCommand.java | 720 ++++++++-----------
.../cache/tier/sockets/BaseCommandQuery.java | 20 +-
.../cache/tier/sockets/CacheClientNotifier.java | 231 ++----
.../ServerInterestRegistrationMessage.java | 120 ++++
.../cache/tier/sockets/command/AddPdxEnum.java | 22 +-
.../cache/tier/sockets/command/AddPdxType.java | 22 +-
.../cache/tier/sockets/command/ClearRegion.java | 52 +-
.../cache/tier/sockets/command/ClientReady.java | 20 +-
.../tier/sockets/command/CloseConnection.java | 28 +-
.../tier/sockets/command/CommitCommand.java | 24 +-
.../cache/tier/sockets/command/ContainsKey.java | 46 +-
.../tier/sockets/command/ContainsKey66.java | 48 +-
.../tier/sockets/command/CreateRegion.java | 44 +-
.../cache/tier/sockets/command/Default.java | 9 +-
.../cache/tier/sockets/command/Destroy.java | 74 +-
.../cache/tier/sockets/command/Destroy65.java | 102 +--
.../cache/tier/sockets/command/Destroy70.java | 4 +-
.../tier/sockets/command/DestroyRegion.java | 75 +-
.../tier/sockets/command/ExecuteFunction.java | 26 +-
.../tier/sockets/command/ExecuteFunction65.java | 30 +-
.../tier/sockets/command/ExecuteFunction66.java | 40 +-
.../tier/sockets/command/ExecuteFunction70.java | 4 +-
.../sockets/command/ExecuteRegionFunction.java | 36 +-
.../command/ExecuteRegionFunction61.java | 40 +-
.../command/ExecuteRegionFunction65.java | 40 +-
.../command/ExecuteRegionFunction66.java | 44 +-
.../command/ExecuteRegionFunctionSingleHop.java | 46 +-
.../sockets/command/GatewayReceiverCommand.java | 214 +++---
.../cache/tier/sockets/command/Get70.java | 74 +-
.../cache/tier/sockets/command/GetAll.java | 52 +-
.../cache/tier/sockets/command/GetAll651.java | 53 +-
.../cache/tier/sockets/command/GetAll70.java | 54 +-
.../cache/tier/sockets/command/GetAllForRI.java | 2 +-
.../sockets/command/GetAllWithCallback.java | 59 +-
.../command/GetClientPRMetadataCommand.java | 26 +-
.../command/GetClientPRMetadataCommand66.java | 26 +-
.../GetClientPartitionAttributesCommand.java | 28 +-
.../GetClientPartitionAttributesCommand66.java | 28 +-
.../sockets/command/GetFunctionAttribute.java | 16 +-
.../tier/sockets/command/GetPDXEnumById.java | 24 +-
.../tier/sockets/command/GetPDXIdForEnum.java | 22 +-
.../tier/sockets/command/GetPDXIdForType.java | 24 +-
.../tier/sockets/command/GetPDXTypeById.java | 24 +-
.../tier/sockets/command/GetPdxEnums70.java | 22 +-
.../tier/sockets/command/GetPdxTypes70.java | 22 +-
.../cache/tier/sockets/command/Invalid.java | 9 +-
.../cache/tier/sockets/command/Invalidate.java | 74 +-
.../tier/sockets/command/Invalidate70.java | 4 +-
.../cache/tier/sockets/command/KeySet.java | 57 +-
.../cache/tier/sockets/command/MakePrimary.java | 22 +-
.../tier/sockets/command/ManagementCommand.java | 2 +-
.../cache/tier/sockets/command/PeriodicAck.java | 32 +-
.../cache/tier/sockets/command/Ping.java | 28 +-
.../cache/tier/sockets/command/Put.java | 86 +--
.../cache/tier/sockets/command/Put61.java | 106 +--
.../cache/tier/sockets/command/Put65.java | 152 ++--
.../cache/tier/sockets/command/Put70.java | 4 +-
.../cache/tier/sockets/command/PutAll.java | 84 +--
.../cache/tier/sockets/command/PutAll70.java | 98 +--
.../cache/tier/sockets/command/PutAll80.java | 112 ++-
.../sockets/command/PutUserCredentials.java | 32 +-
.../cache/tier/sockets/command/Query.java | 26 +-
.../cache/tier/sockets/command/Query651.java | 41 +-
.../command/RegisterDataSerializers.java | 30 +-
.../sockets/command/RegisterInstantiators.java | 36 +-
.../tier/sockets/command/RegisterInterest.java | 88 +--
.../sockets/command/RegisterInterest61.java | 98 +--
.../sockets/command/RegisterInterestList.java | 88 +--
.../sockets/command/RegisterInterestList61.java | 94 +--
.../sockets/command/RegisterInterestList66.java | 92 +--
.../cache/tier/sockets/command/RemoveAll.java | 103 ++-
.../tier/sockets/command/RemoveUserAuth.java | 32 +-
.../cache/tier/sockets/command/Request.java | 68 +-
.../tier/sockets/command/RequestEventValue.java | 52 +-
.../tier/sockets/command/RollbackCommand.java | 20 +-
.../cache/tier/sockets/command/Size.java | 34 +-
.../tier/sockets/command/TXFailoverCommand.java | 28 +-
.../command/TXSynchronizationCommand.java | 51 +-
.../sockets/command/UnregisterInterest.java | 50 +-
.../sockets/command/UnregisterInterestList.java | 50 +-
.../command/UpdateClientNotification.java | 4 +-
.../cache/tier/sockets/command/CloseCQ.java | 34 +-
.../cache/tier/sockets/command/ExecuteCQ.java | 42 +-
.../cache/tier/sockets/command/ExecuteCQ61.java | 53 +-
.../cache/tier/sockets/command/GetCQStats.java | 29 +-
.../tier/sockets/command/GetDurableCQs.java | 40 +-
.../cache/tier/sockets/command/MonitorCQ.java | 31 +-
.../cache/tier/sockets/command/StopCQ.java | 34 +-
95 files changed, 2549 insertions(+), 2739 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/GemFireException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/GemFireException.java b/geode-core/src/main/java/org/apache/geode/GemFireException.java
index 02bf025..3a69307 100644
--- a/geode-core/src/main/java/org/apache/geode/GemFireException.java
+++ b/geode-core/src/main/java/org/apache/geode/GemFireException.java
@@ -12,74 +12,55 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode;
/**
* This is the abstract superclass of exceptions that are thrown to indicate incorrect usage of
* GemFire.
- *
+ * <p>
* Since these exceptions are unchecked, this class really <em>ought</em> to be called
- * <code>GemFireRuntimeException</code>; however, the current name is retained for compatibility's
+ * {@code GemFireRuntimeException}; however, the current name is retained for compatibility's
* sake.
- *
- * @see org.apache.geode.GemFireCheckedException
+ * <p>
+ * This class is abstract to enforce throwing more specific exception types. Please avoid using
+ * GemFireException to describe an arbitrary error condition
+ *
+ * @see GemFireCheckedException
* @see org.apache.geode.cache.CacheRuntimeException
*/
-// Implementation note: This class is abstract so that we are forced
-// to have more specific exception types. We want to avoid using
-// GemFireException to describe an arbitrary error condition (think
-// GsError).
public abstract class GemFireException extends RuntimeException {
- public static final long serialVersionUID = -6972360779789402295L;
-
- /** The cause of this <code>GemFireException</code> */
- // private Throwable cause;
-
- ////////////////////// Constructors //////////////////////
+ private static final long serialVersionUID = -6972360779789402295L;
/**
- * Creates a new <code>GemFireException</code> with no detailed message.
+ * Creates a new {@code GemFireException} with no detailed message.
*/
public GemFireException() {
super();
}
/**
- * Creates a new <code>GemFireException</code> with the given detail message.
+ * Creates a new {@code GemFireException} with the given detail message.
*/
public GemFireException(String message) {
super(message);
}
/**
- * Creates a new <code>GemFireException</code> with the given detail message and cause.
+ * Creates a new {@code GemFireException} with the given detail message and cause.
*/
public GemFireException(String message, Throwable cause) {
super(message, cause);
- // this.cause = cause;
}
/**
- * Creates a new <code>GemFireException</code> with the given cause and no detail message
+ * Creates a new {@code GemFireException} with the given cause and no detail message
*/
public GemFireException(Throwable cause) {
super(cause);
- // this.cause = cause;
}
- //////////////////// Instance Methods ////////////////////
-
- /**
- * Returns the cause of this <code>GemFireException</code> or <code>null</code> if the cause is
- * nonexistent or unknown.
- */
- // public Throwable getCause() {
- // return this.cause;
- // }
-
/**
- * Returns the root cause of this <code>GemFireException</code> or <code>null</code> if the cause
+ * Returns the root cause of this {@code GemFireException} or {@code null} if the cause
* is nonexistent or unknown.
*/
public Throwable getRootCause() {
@@ -93,52 +74,4 @@ public abstract class GemFireException extends RuntimeException {
return root;
}
- // public void printStackTrace() {
- // super.printStackTrace();
- // if (this.cause != null) {
- // System.err.println("Caused by:");
- // this.cause.printStackTrace();
- // }
- // }
-
- // public void printStackTrace(java.io.PrintWriter pw) {
- // super.printStackTrace(pw);
- //
- // if (this.cause != null) {
- // pw.println("Caused by:");
- // this.cause.printStackTrace(pw);
- // }
- // }
- //
- // public String getMessage() {
- // if (this.cause != null) {
- // String ourMsg = super.getMessage();
- // if (ourMsg == null || ourMsg.length() == 0) {
- // //ourMsg = super.toString(); //causes inifinite recursion
- // ourMsg = "";
- // }
- // StringBuffer sb = new StringBuffer(ourMsg);
- // sb.append(" Caused by: ");
- // String causeMsg = this.cause.getMessage();
- // if (causeMsg == null || causeMsg.length() == 0) {
- // causeMsg = this.cause.toString();
- // }
- // sb.append(causeMsg);
- // return sb.toString();
- // } else {
- // return super.getMessage();
- // }
- // }
-
- /**
- * Represent the receiver as well as the cause
- */
- // public String toString() {
- // String result = super.toString();
- // if (cause != null) {
- // result = result + ", caused by " + cause.toString();
- // }
- // return result;
- // }
-
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/cache/CacheException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheException.java b/geode-core/src/main/java/org/apache/geode/cache/CacheException.java
index 79591d6..6309ad1 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheException.java
@@ -16,36 +16,34 @@ package org.apache.geode.cache;
import org.apache.geode.GemFireException;
-
/**
* A generic exception, which indicates a cache error has occurred. All the other cache exceptions
* are subclasses of this class. This class is abstract and therefore only subclasses are
* instantiated.
*
- *
* @since GemFire 2.0
*/
public abstract class CacheException extends GemFireException {
- public static final long serialVersionUID = 7699432887938858940L;
+ private static final long serialVersionUID = 7699432887938858940L;
- /** Constructs a new <code>CacheException</code>. */
+ /** Constructs a new {@code CacheException}. */
public CacheException() {
super();
}
- /** Constructs a new <code>CacheException</code> with a message string. */
+ /** Constructs a new {@code CacheException} with a message string. */
public CacheException(String s) {
super(s);
}
/**
- * Constructs a <code>CacheException</code> with a message string and a base exception
+ * Constructs a {@code CacheException} with a message string and a base exception
*/
public CacheException(String s, Throwable cause) {
super(s, cause);
}
- /** Constructs a <code>CacheException</code> with a cause */
+ /** Constructs a {@code CacheException} with a cause */
public CacheException(Throwable cause) {
super(cause);
}
@@ -57,7 +55,7 @@ public abstract class CacheException extends GemFireException {
if (cause != null) {
String causeStr = cause.toString();
final String glue = ", caused by ";
- StringBuffer sb = new StringBuffer(result.length() + causeStr.length() + glue.length());
+ StringBuilder sb = new StringBuilder(result.length() + causeStr.length() + glue.length());
sb.append(result).append(glue).append(causeStr);
result = sb.toString();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/cache/CacheRuntimeException.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheRuntimeException.java b/geode-core/src/main/java/org/apache/geode/cache/CacheRuntimeException.java
index a723b32..89b596f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheRuntimeException.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheRuntimeException.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.cache;
import org.apache.geode.GemFireException;
@@ -22,20 +21,18 @@ import org.apache.geode.GemFireException;
* cache exceptions are the subclass of this class. This class is abstract so only subclasses can be
* instantiated
*
- *
* @since GemFire 3.0
*/
public abstract class CacheRuntimeException extends GemFireException {
- public static final long serialVersionUID = 6750107573015376688L;
+ private static final long serialVersionUID = 6750107573015376688L;
/**
- * Creates a new instance of <code>CacheRuntimeException</code> without detail message.
+ * Creates a new instance of {@code CacheRuntimeException} without detail message.
*/
public CacheRuntimeException() {}
-
/**
- * Constructs an instance of <code>CacheRuntimeException</code> with the specified detail message.
+ * Constructs an instance of {@code CacheRuntimeException} with the specified detail message.
*
* @param msg the detail message
*/
@@ -44,7 +41,7 @@ public abstract class CacheRuntimeException extends GemFireException {
}
/**
- * Constructs an instance of <code>CacheRuntimeException</code> with the specified detail message
+ * Constructs an instance of {@code CacheRuntimeException} with the specified detail message
* and cause.
*
* @param msg the detail message
@@ -55,7 +52,7 @@ public abstract class CacheRuntimeException extends GemFireException {
}
/**
- * Constructs an instance of <code>CacheRuntimeException</code> with the specified cause.
+ * Constructs an instance of {@code CacheRuntimeException} with the specified cause.
*
* @param cause the causal Throwable
*/
@@ -70,7 +67,7 @@ public abstract class CacheRuntimeException extends GemFireException {
if (cause != null) {
String causeStr = cause.toString();
final String glue = ", caused by ";
- StringBuffer sb = new StringBuffer(result.length() + causeStr.length() + glue.length());
+ StringBuilder sb = new StringBuilder(result.length() + causeStr.length() + glue.length());
sb.append(result).append(glue).append(causeStr);
result = sb.toString();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
index ac500e6..5b0d86b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
@@ -372,7 +372,7 @@ import org.apache.geode.internal.cache.snapshot.FlowController.FlowControlAbortM
import org.apache.geode.internal.cache.snapshot.FlowController.FlowControlAckMessage;
import org.apache.geode.internal.cache.snapshot.SnapshotPacket;
import org.apache.geode.internal.cache.snapshot.SnapshotPacket.SnapshotRecord;
-import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier.ServerInterestRegistrationMessage;
+import org.apache.geode.internal.cache.tier.sockets.ServerInterestRegistrationMessage;
import org.apache.geode.internal.cache.tier.sockets.ClientBlacklistProcessor.ClientBlacklistMessage;
import org.apache.geode.internal.cache.tier.sockets.ClientDataSerializerMessage;
import org.apache.geode.internal.cache.tier.sockets.ClientInstantiatorMessage;
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 8d4eaf7..02d04b3 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -183,7 +183,6 @@ import org.apache.geode.internal.cache.partitioned.ContainsKeyValueMessage;
import org.apache.geode.internal.cache.partitioned.ContainsKeyValueMessage.ContainsKeyValueResponse;
import org.apache.geode.internal.cache.partitioned.DestroyMessage;
import org.apache.geode.internal.cache.partitioned.DestroyMessage.DestroyResponse;
-import org.apache.geode.internal.cache.partitioned.DestroyRegionOnDataStoreMessage;
import org.apache.geode.internal.cache.partitioned.DumpAllPRConfigMessage;
import org.apache.geode.internal.cache.partitioned.DumpB2NRegion;
import org.apache.geode.internal.cache.partitioned.DumpB2NRegion.DumpB2NResponse;
@@ -4479,7 +4478,7 @@ public class PartitionedRegion extends LocalRegion
values.addObjectPart(key, ge.value, ge.isObject, ge.versionTag);
}
- if (values.size() == BaseCommand.maximumChunkSize) {
+ if (values.size() == BaseCommand.MAXIMUM_CHUNK_SIZE) {
BaseCommand.sendNewRegisterInterestResponseChunk(this, "keyList", values, false,
servConn);
values.clear();
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
index f75a912..c0d3342 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java
@@ -2057,6 +2057,21 @@ public class HARegionQueue implements RegionQueue {
* a single peek thread.
*/
private static class BlockingHARegionQueue extends HARegionQueue {
+
+ private static final String EVENT_ENQUEUE_WAIT_TIME_NAME =
+ DistributionConfig.GEMFIRE_PREFIX + "subscription.EVENT_ENQUEUE_WAIT_TIME";
+
+ private static final int DEFAULT_EVENT_ENQUEUE_WAIT_TIME = 100;
+
+ /**
+ * System property name for indicating how much frequently the "Queue full" message should be
+ * logged.
+ */
+ private static final String MAX_QUEUE_LOG_FREQUENCY =
+ DistributionConfig.GEMFIRE_PREFIX + "logFrequency.clientQueueReachedMaxLimit";
+
+ private static final long DEFAULT_LOG_FREQUENCY = 1000;
+
/**
* Guards the Put permits
*/
@@ -2079,14 +2094,26 @@ public class HARegionQueue implements RegionQueue {
*/
private final Object permitMon = new Object();
- // Lock on which the take & remove threads block awaiting data from put
- // operations
+ /**
+ * Lock on which the take & remove threads block awaiting data from put
+ * operations
+ */
private final StoppableReentrantLock lock;
/**
* Condition object on which peek & take threads will block
*/
- protected final StoppableCondition blockCond;
+ final StoppableCondition blockCond;
+
+ /**
+ * System property value denoting the time in milliseconds. Any thread putting an event into a
+ * subscription queue, which is full, will wait this much time for the queue to make space. It'll
+ * then enqueue the event possibly causing the queue to grow beyond its capacity/max-size. See
+ * #51400.
+ */
+ private final int enqueueEventWaitTime;
+
+ private final long logFrequency;
/**
* @param hrqa HARegionQueueAttributes through which expiry time etc for the HARegionQueue can
@@ -2097,16 +2124,43 @@ public class HARegionQueue implements RegionQueue {
HARegionQueueAttributes hrqa, Map haContainer, ClientProxyMembershipID clientProxyId,
final byte clientConflation, boolean isPrimary)
throws IOException, ClassNotFoundException, CacheException, InterruptedException {
+
super(regionName, cache, hrqa, haContainer, clientProxyId, clientConflation, isPrimary);
this.capacity = hrqa.getBlockingQueueCapacity();
this.putPermits = this.capacity;
this.lock = new StoppableReentrantLock(this.region.getCancelCriterion());
- this.blockCond = lock.newCondition();
+ this.blockCond = this.lock.newCondition();
super.putGIIDataInRegion();
- if (this.getClass() == BlockingHARegionQueue.class) {
- initialized.set(true);
+
+ if (getClass() == BlockingHARegionQueue.class) {
+ this.initialized.set(true);
}
+
+ this.enqueueEventWaitTime = calcEnqueueEventWaitTime();
+ this.logFrequency = calcLogFrequency();
+ }
+
+ private static int calcEnqueueEventWaitTime() {
+ int value =
+ Integer.getInteger(EVENT_ENQUEUE_WAIT_TIME_NAME, DEFAULT_EVENT_ENQUEUE_WAIT_TIME);
+ if (value < 0) {
+ value = DEFAULT_EVENT_ENQUEUE_WAIT_TIME;
+ }
+ return value;
+ }
+
+ private static long calcLogFrequency() {
+ long value;
+ try {
+ value = Long.valueOf(System.getProperty(MAX_QUEUE_LOG_FREQUENCY));
+ if (value <= 0) {
+ value = DEFAULT_LOG_FREQUENCY;
+ }
+ } catch (NumberFormatException ignore) {
+ value = DEFAULT_LOG_FREQUENCY;
+ }
+ return value;
}
@Override
@@ -2134,56 +2188,55 @@ public class HARegionQueue implements RegionQueue {
* in the HARegionQueue.
*/
@Override
- @edu.umd.cs.findbugs.annotations.SuppressWarnings("TLW_TWO_LOCK_WAIT")
+ @SuppressWarnings("TLW_TWO_LOCK_WAIT")
void checkQueueSizeConstraint() throws InterruptedException {
- if (this.haContainer instanceof HAContainerMap && isPrimary()) { // Fix for bug 39413
- if (Thread.interrupted())
- throw new InterruptedException();
- synchronized (this.putGuard) {
- if (putPermits <= 0) {
- synchronized (this.permitMon) {
- if (reconcilePutPermits() <= 0) {
- if (region.getSystem().getConfig().getRemoveUnresponsiveClient()) {
- isClientSlowReciever = true;
- } else {
- try {
- long logFrequency = CacheClientNotifier.DEFAULT_LOG_FREQUENCY;
- CacheClientNotifier ccn = CacheClientNotifier.getInstance();
- if (ccn != null) { // check needed for junit tests
- logFrequency = ccn.getLogFrequency();
- }
- if ((this.maxQueueSizeHitCount % logFrequency) == 0) {
- logger.warn(LocalizedMessage.create(
- LocalizedStrings.HARegionQueue_CLIENT_QUEUE_FOR_0_IS_FULL,
- new Object[] {region.getName()}));
- this.maxQueueSizeHitCount = 0;
- }
- ++this.maxQueueSizeHitCount;
- this.region.checkReadiness(); // fix for bug 37581
- // TODO: wait called while holding two locks
- this.permitMon.wait(CacheClientNotifier.eventEnqueueWaitTime);
- this.region.checkReadiness(); // fix for bug 37581
- // Fix for #51400. Allow the queue to grow beyond its
- // capacity/maxQueueSize, if it is taking a long time to
- // drain the queue, either due to a slower client or the
- // deadlock scenario mentioned in the ticket.
- reconcilePutPermits();
- if ((this.maxQueueSizeHitCount % logFrequency) == 1) {
- logger.info(LocalizedMessage
- .create(LocalizedStrings.HARegionQueue_RESUMING_WITH_PROCESSING_PUTS));
- }
- } catch (InterruptedException ex) {
- // TODO: The line below is meaningless. Comment it out later
- this.permitMon.notifyAll();
- throw ex;
+ if (!(this.haContainer instanceof HAContainerMap && isPrimary())) {
+ // Fix for bug 39413
+ return;
+ }
+ if (Thread.interrupted()) {
+ throw new InterruptedException();
+ }
+
+ synchronized (this.putGuard) {
+ if (this.putPermits <= 0) {
+ synchronized (this.permitMon) {
+ if (reconcilePutPermits() <= 0) {
+ if (this.region.getSystem().getConfig().getRemoveUnresponsiveClient()) {
+ this.isClientSlowReciever = true;
+ } else {
+ try {
+ if ((this.maxQueueSizeHitCount % this.logFrequency) == 0) {
+ logger.warn(LocalizedMessage.create(
+ LocalizedStrings.HARegionQueue_CLIENT_QUEUE_FOR_0_IS_FULL,
+ new Object[] { this.region.getName() }));
+ this.maxQueueSizeHitCount = 0;
+ }
+ ++this.maxQueueSizeHitCount;
+ this.region.checkReadiness(); // fix for bug 37581
+ // TODO: wait called while holding two locks
+ this.permitMon.wait(this.enqueueEventWaitTime);
+ this.region.checkReadiness(); // fix for bug 37581
+ // Fix for #51400. Allow the queue to grow beyond its
+ // capacity/maxQueueSize, if it is taking a long time to
+ // drain the queue, either due to a slower client or the
+ // deadlock scenario mentioned in the ticket.
+ reconcilePutPermits();
+ if (this.maxQueueSizeHitCount % this.logFrequency == 1) {
+ logger.info(LocalizedMessage
+ .create(LocalizedStrings.HARegionQueue_RESUMING_WITH_PROCESSING_PUTS));
}
+ } catch (InterruptedException ex) {
+ // TODO: The line below is meaningless. Comment it out later
+ this.permitMon.notifyAll();
+ throw ex;
}
}
- } // synchronized (this.permitMon)
- } // if (putPermits <= 0)
- --putPermits;
- } // synchronized (this.putGuard)
- }
+ }
+ } // synchronized (this.permitMon)
+ } // if (putPermits <= 0)
+ --this.putPermits;
+ } // synchronized (this.putGuard)
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
index 0c1c42a..d7f7c7b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/Command.java
@@ -12,22 +12,17 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache.tier;
-import org.apache.geode.internal.cache.tier.sockets.*;
+import org.apache.geode.internal.cache.tier.sockets.Message;
+import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
-/**
- *
- */
public interface Command {
- public void execute(Message msg, ServerConnection servConn);
+ void execute(Message message, ServerConnection serverConnection);
- public final int RESPONDED = 1;
+ int RESPONDED = 1;
- public final int REQUIRES_RESPONSE = 2;
+ int REQUIRES_RESPONSE = 2;
- public final int REQUIRES_CHUNKED_RESPONSE = 3;
+ int REQUIRES_CHUNKED_RESPONSE = 3;
}
[13/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
index 6071836..3364a6e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEntry {
+
public VersionedThinRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEn
}
private static class VersionedThinRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VersionedThinRegionEntryHeap extends VersionedThinRegionEn
return new VersionedThinRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
index 21c1806..f225bac 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegio
}
private static class VersionedThinRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinRegionEntryOffHeap extends VersionedThinRegio
return new VersionedThinRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
index da0c190..1f328ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/ResourceAdvisor.java
@@ -436,7 +436,7 @@ public class ResourceAdvisor extends DistributionAdvisor {
});
}
- public final boolean isHeapCritical(final InternalDistributedMember member) {
+ public boolean isHeapCritical(final InternalDistributedMember member) {
ResourceManagerProfile rmp = (ResourceManagerProfile) getProfile(member);
return rmp != null ? rmp.getHeapState().isCritical() : false;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
index 0fd607c..b1e5bab 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/locks/TXLockIdImpl.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.locks;
import org.apache.geode.internal.DataSerializableFixedID;
@@ -25,11 +24,11 @@ import org.apache.geode.distributed.internal.membership.*;
/**
* Identifies a group of transaction locks.
- *
*/
public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
private static final long serialVersionUID = 8579214625084490134L;
+
/** DistributionManager id for this member */
private InternalDistributedMember memberId;
@@ -122,7 +121,7 @@ public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
out.writeInt(this.id);
}
- public static final TXLockIdImpl createFromData(DataInput in)
+ public static TXLockIdImpl createFromData(DataInput in)
throws IOException, ClassNotFoundException {
TXLockIdImpl result = new TXLockIdImpl();
result.fromData(in);
@@ -131,7 +130,6 @@ public class TXLockIdImpl implements TXLockId, DataSerializableFixedID {
@Override
public Version[] getSerializationVersions() {
- // TODO Auto-generated method stub
return null;
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
index 9b69c7e..b07a124 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/lru/LRUAlgorithm.java
@@ -16,13 +16,16 @@ package org.apache.geode.internal.cache.lru;
import org.apache.geode.InternalGemFireException;
import org.apache.geode.StatisticsFactory;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.CacheCallback;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.Region;
import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.PlaceHolderDiskRegion;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
/**
* Eviction controllers that extend this class evict the least recently used (LRU) entry in the
@@ -67,8 +70,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
*/
public static final String EVICTION_ACTION = "eviction-action";
- //////////////////////// Instance Fields ///////////////////////
-
/** What to do upon eviction */
protected EvictionAction evictionAction;
@@ -79,7 +80,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
private transient EnableLRU helper;
protected BucketRegion bucketRegion;
- ///////////////////////// Constructors /////////////////////////
/**
* Creates a new <code>LRUAlgorithm</code> with the given {@linkplain EvictionAction eviction
@@ -91,8 +91,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
this.helper = createLRUHelper();
}
- /////////////////////// Instance Methods ///////////////////////
-
/**
* Used to hook up a bucketRegion late during disk recover.
*/
@@ -131,7 +129,7 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
* For internal use only. Returns a helper object used internally by the GemFire cache
* implementation.
*/
- public final EnableLRU getLRUHelper() {
+ public EnableLRU getLRUHelper() {
synchronized (this) {
// Synchronize with readObject/writeObject to avoid race
// conditions with copy sharing. See bug 31047.
@@ -154,24 +152,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
}
}
- // public void writeExternal(ObjectOutput out)
- // throws IOException {
- // out.writeObject(this.evictionAction);
- // }
-
- // public void readExternal(ObjectInput in)
- // throws IOException, ClassNotFoundException {
- // String evictionAction = (String) in.readObject();
- // this.setEvictionAction(evictionAction);
- // }
-
- // protected Object readResolve() throws ObjectStreamException {
- // if (this.helper == null) {
- // this.helper = createLRUHelper();
- // }
- // return this;
- // }
-
/**
* Creates a new <code>LRUHelper</code> tailed for this LRU algorithm implementation.
*/
@@ -241,11 +221,7 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- *
+ /**
* Note that we just need to make sure that equal objects return equal hashcodes; nothing really
* elaborate is done here.
*/
@@ -262,8 +238,6 @@ public abstract class LRUAlgorithm implements CacheCallback, Serializable, Clone
@Override
public abstract String toString();
- ////////////////////// Inner Classes //////////////////////
-
/**
* A partial implementation of the <code>EnableLRU</code> interface that contains code common to
* all <code>LRUAlgorithm</code>s.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
index 8d164c8..c4a3fbd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/BucketBackupMessage.java
@@ -44,7 +44,7 @@ public class BucketBackupMessage extends PartitionMessage {
private int bucketId;
/**
- * Empty contstructor provided for {@link org.apache.geode.DataSerializer}
+ * Empty constructor provided for {@link org.apache.geode.DataSerializer}
*/
public BucketBackupMessage() {
super();
@@ -73,7 +73,7 @@ public class BucketBackupMessage extends PartitionMessage {
* of the initialization
*/
@Override
- protected final boolean failIfRegionMissing() {
+ protected boolean failIfRegionMissing() {
return false;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
index f1633bd..c9d7d70 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/DeposePrimaryBucketMessage.java
@@ -98,8 +98,8 @@ public class DeposePrimaryBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
index 664ebe7..1072576 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchEntryMessage.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.partitioned;
import java.io.DataInput;
@@ -85,7 +84,6 @@ public class FetchEntryMessage extends PartitionMessage {
* @param recipient the member that the getEntry message is sent to
* @param r the PartitionedRegion for which getEntry was performed upon
* @param key the object to which the value should be feteched
- * @param access
* @return the processor used to fetch the returned value associated with the key
* @throws ForceReattemptException if the peer is no longer available
*/
@@ -109,11 +107,6 @@ public class FetchEntryMessage extends PartitionMessage {
fromData(in);
}
- // final public int getProcessorType()
- // {
- // return DistributionManager.PARTITIONED_REGION_EXECUTOR;
- // }
-
@Override
public boolean isSevereAlertCompatible() {
// allow forced-disconnect processing for all cache op messages
@@ -121,7 +114,7 @@ public class FetchEntryMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r,
long startTime) throws ForceReattemptException {
// FetchEntryMessage is used in refreshing client caches during interest list recovery,
// so don't be too verbose or hydra tasks may time out
@@ -209,7 +202,7 @@ public class FetchEntryMessage extends PartitionMessage {
return s;
}
- public final void setKey(Object key) {
+ public void setKey(Object key) {
this.key = key;
}
@@ -322,9 +315,7 @@ public class FetchEntryMessage extends PartitionMessage {
}
/**
- * A processor to capture the value returned by
- * {@link org.apache.geode.internal.cache.partitioned.FetchEntryMessage.FetchEntryReplyMessage}
- *
+ * A processor to capture the value returned by {@link FetchEntryMessage.FetchEntryReplyMessage}
*/
public static class FetchEntryResponse extends PartitionResponse {
private volatile EntrySnapshot returnValue;
@@ -356,13 +347,10 @@ public class FetchEntryMessage extends PartitionMessage {
/**
* @return Object associated with the key that was sent in the get message
- * @throws EntryNotFoundException
* @throws ForceReattemptException if the peer is no longer available
- * @throws EntryNotFoundException
*/
public EntrySnapshot waitForResponse() throws EntryNotFoundException, ForceReattemptException {
try {
- // waitForRepliesUninterruptibly();
waitForCacheException();
} catch (ForceReattemptException e) {
e.checkKey(key);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
index 21dfa8d..523186d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/FetchPartitionDetailsMessage.java
@@ -99,8 +99,8 @@ public class FetchPartitionDetailsMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionMemberInfoImpl details = (PartitionMemberInfoImpl) region.getRedundancyProvider()
.buildPartitionMemberDetails(this.internal, this.loadProbe);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
index 6f18013..2d2b3c4 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/MoveBucketMessage.java
@@ -47,7 +47,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
* Usage: MoveBucketResponse response = MoveBucketMessage.send( InternalDistributedMember,
* PartitionedRegion, int bucketId); if (response != null && response.waitForResponse()) { // bucket
* was moved }
- *
*/
public class MoveBucketMessage extends PartitionMessage {
private static final Logger logger = LogService.getLogger();
@@ -106,8 +105,8 @@ public class MoveBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionedRegionDataStore dataStore = region.getDataStore();
boolean moved = dataStore.moveBucket(this.bucketId, this.source, true);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
index 6b59f51..8c27107 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PartitionMessage.java
@@ -184,24 +184,17 @@ public abstract class PartitionMessage extends DistributionMessage
this.isTransactionDistributed = other.isTransactionDistributed;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geode.internal.cache.TransactionMessage#getTXOriginatorClient()
- */
public InternalDistributedMember getTXOriginatorClient() {
return txMemberId;
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
}
return txMemberId;
}
-
-
/**
* Severe alert processing enables suspect processing at the ack-wait-threshold and issuing of a
* severe alert at the end of the ack-severe-alert-threshold. Some messages should not support
@@ -669,11 +662,6 @@ public abstract class PartitionMessage extends DistributionMessage
// subclasses that support routing to clients should reimplement this method
}
- /*
- * public void appendOldValueToMessage(EntryEventImpl event) {
- *
- * }
- */
/**
* @return the txUniqId
*/
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
index 7ee54d8..1898461 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveAllPRMessage.java
@@ -342,7 +342,6 @@ public class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
@Override
protected Object clone() throws CloneNotSupportedException {
- // TODO Auto-generated method stub
return super.clone();
}
@@ -629,9 +628,8 @@ public class RemoveAllPRMessage extends PartitionMessageWithDirectReply {
RemoveAllReplyMessage.send(member, procId, getReplySender(dm), this.result, this.versions, ex);
}
-
@Override
- protected final void appendFields(StringBuilder buff) {
+ protected void appendFields(StringBuilder buff) {
super.appendFields(buff);
buff.append("; removeAllPRDataSize=").append(removeAllPRDataSize).append("; bucketId=")
.append(bucketId);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
index a8ff068..6650549 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/RemoveBucketMessage.java
@@ -45,7 +45,6 @@ import org.apache.geode.internal.logging.log4j.LogMarker;
* Usage: RemoveBucketResponse response = RemoveBucketMessage.send( InternalDistributedMember,
* PartitionedRegion, int bucketId); if (response != null && response.waitForResponse()) { // bucket
* was removed }
- *
*/
public class RemoveBucketMessage extends PartitionMessage {
private static final Logger logger = LogService.getLogger();
@@ -53,7 +52,6 @@ public class RemoveBucketMessage extends PartitionMessage {
private int bucketId;
private boolean forceRemovePrimary;
-
/**
* Empty constructor to satisfy {@link DataSerializer} requirements
*/
@@ -103,8 +101,8 @@ public class RemoveBucketMessage extends PartitionMessage {
}
@Override
- protected final boolean operateOnPartitionedRegion(DistributionManager dm,
- PartitionedRegion region, long startTime) throws ForceReattemptException {
+ protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region,
+ long startTime) throws ForceReattemptException {
PartitionedRegionDataStore dataStore = region.getDataStore();
boolean removed = dataStore.removeBucket(this.bucketId, this.forceRemovePrimary);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
index 0c6aea8..a6c9707 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/SizeMessage.java
@@ -110,7 +110,7 @@ public class SizeMessage extends PartitionMessage {
* of the initialization
*/
@Override
- protected final boolean failIfRegionMissing() {
+ protected boolean failIfRegionMissing() {
return false;
}
@@ -154,10 +154,6 @@ public class SizeMessage extends PartitionMessage {
sizes = ds.getSizeForLocalBuckets();
}
}
- // if (logger.isTraceEnabled(LogMarker.DM)) {
- // l.fine(getClass().getName() + " send sizes back using processorId: "
- // + getProcessorId());
- // }
r.getPrStats().endPartitionMessagesProcessing(startTime);
SizeReplyMessage.send(getSender(), getProcessorId(), dm, sizes);
} // datastore exists
@@ -270,7 +266,7 @@ public class SizeMessage extends PartitionMessage {
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
- this.bucketSizes = (Map<Integer, SizeEntry>) DataSerializer.readObject(in);
+ this.bucketSizes = DataSerializer.readObject(in);
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
index 728abf7..291db65 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientUpdater.java
@@ -1872,11 +1872,11 @@ public class CacheClientUpdater extends Thread implements ClientUpdater, Disconn
this.stats.close();
}
- public final void incReceivedBytes(long v) {
+ public void incReceivedBytes(long v) {
this.stats.incLong(receivedBytesId, v);
}
- public final void incSentBytes(long v) {
+ public void incSentBytes(long v) {
// noop since we never send messages
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
index 889980f..cfe812c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
@@ -34,14 +34,15 @@ import org.apache.geode.internal.offheap.StoredObject;
* to edge requests
*
* @see Message
- *
* @since GemFire 2.0.2
*/
public class Part {
+
private static final byte BYTE_CODE = 0;
private static final byte OBJECT_CODE = 1;
private Version version;
+
/**
* Used to represent and empty byte array for bug 36279
*
@@ -68,7 +69,6 @@ public class Part {
this.typeCode = tc;
}
-
public void clear() {
if (this.part != null) {
if (this.part instanceof HeapDataOutputStream) {
@@ -249,7 +249,6 @@ public class Part {
| ((((long) bytes[6]) << 8) & 0x000000000000FF00l) | (bytes[7] & 0x00000000000000FFl);
}
-
public byte[] getSerializedForm() {
if (this.part == null) {
return null;
@@ -291,7 +290,7 @@ public class Part {
*
* @param buf the buffer to use if any data needs to be copied to one
*/
- public final void writeTo(OutputStream out, ByteBuffer buf) throws IOException {
+ public void writeTo(OutputStream out, ByteBuffer buf) throws IOException {
if (getLength() > 0) {
if (this.part instanceof byte[]) {
byte[] bytes = (byte[]) this.part;
@@ -436,19 +435,6 @@ public class Part {
sb.append("partCode=");
sb.append(typeCodeToString(this.typeCode));
sb.append(" partLength=" + getLength());
- // sb.append(" partBytes=");
- // byte[] b = getSerializedForm();
- // if (b == null) {
- // sb.append("null");
- // }
- // else {
- // sb.append("(");
- // for (int i = 0; i < b.length; i ++) {
- // sb.append(Integer.toString(b[i]));
- // sb.append(" ");
- // }
- // sb.append(")");
- // }
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
index 39f30d6..f8771f7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java
@@ -904,28 +904,6 @@ public class ParallelGatewaySenderQueue implements RegionQueue {
throw new UnsupportedOperationException();
}
- /**
- * TODO: Optimization needed. We are creating 1 array list for each peek!!
- *
- * @return BucketRegionQueue
- */
- private final BucketRegionQueue getRandomBucketRegionQueue() {
- PartitionedRegion prQ = getRandomShadowPR();
- if (prQ != null) {
- final PartitionedRegionDataStore ds = prQ.getDataStore();
- final List<Integer> buckets = new ArrayList<Integer>(ds.getAllLocalPrimaryBucketIds());
- if (buckets.isEmpty())
- return null;
- final int index = new Random().nextInt(buckets.size());
- final int brqId = buckets.get(index);
- final BucketRegionQueue brq = (BucketRegionQueue) ds.getLocalBucketById(brqId);
- if (brq.isReadyForPeek()) {
- return brq;
- }
- }
- return null;
- }
-
protected boolean areLocalBucketQueueRegionsPresent() {
boolean bucketsAvailable = false;
for (PartitionedRegion prQ : this.userRegionNameToshadowPRMap.values()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
index d38b2c7..b23615a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/BatchDestroyOperation.java
@@ -126,13 +126,6 @@ public class BatchDestroyOperation extends DistributedCacheOperation {
}
}
}
- // Non-optimized way
- // for (Long k : (Set<Long>)rgn.keys()) {
- // if (k > this.tailKey) {
- // continue;
- // }
- // rgn.localDestroy(k, RegionQueue.WAN_QUEUE_TOKEN);
- // }
this.appliedOperation = true;
} catch (CacheWriterException e) {
throw new Error(
@@ -147,8 +140,7 @@ public class BatchDestroyOperation extends DistributedCacheOperation {
@Override
@Retained
- protected final InternalCacheEvent createEvent(DistributedRegion rgn)
- throws EntryNotFoundException {
+ protected InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException {
EntryEventImpl ev = createEntryEvent(rgn);
boolean evReturned = false;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
index 9501666..9eb6dfe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheTransactionManagerCreation.java
@@ -28,24 +28,20 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* Represents a {@link CacheTransactionManager} that is created declaratively.
*
- *
* @since GemFire 4.0
*/
public class CacheTransactionManagerCreation implements CacheTransactionManager {
- /////////////////////// Instance Fields ///////////////////////
-
/** The TransactionListener instance set using the cache's CacheTransactionManager */
private final ArrayList txListeners = new ArrayList();
+
private TransactionWriter writer = null;
- /////////////////////// Constructors ///////////////////////
/**
* Creates a new <code>CacheTransactionManagerCreation</code>
*/
public CacheTransactionManagerCreation() {}
- ////////////////////// Instance Methods //////////////////////
public TransactionListener setListener(TransactionListener newListener) {
TransactionListener result = getListener();
this.txListeners.clear();
@@ -78,7 +74,7 @@ public class CacheTransactionManagerCreation implements CacheTransactionManager
return result;
}
- public final TransactionListener getListener() {
+ public TransactionListener getListener() {
if (this.txListeners.isEmpty()) {
return null;
} else if (this.txListeners.size() == 1) {
@@ -120,7 +116,7 @@ public class CacheTransactionManagerCreation implements CacheTransactionManager
.toLocalizedString());
}
- public final void setWriter(TransactionWriter writer) {
+ public void setWriter(TransactionWriter writer) {
this.writer = writer;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
index 413fc4a..460f107 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlVersion.java
@@ -19,12 +19,13 @@ import java.util.HashMap;
/**
* {@link Enum} for Cache XML versions. Resolves issues with old String based comparisons. Under the
* old String comparison version "8.1" was older than "8_0" and "10.0" was older than "9.0".
- *
+ * <p>
+ * TODO future - replace constants in CacheXml with this Enum completely
*
* @since GemFire 8.1
*/
-// TODO future - replace constants in CacheXml with this Enum completely
public enum CacheXmlVersion {
+
GEMFIRE_3_0(CacheXml.VERSION_3_0, CacheXml.PUBLIC_ID_3_0, CacheXml.SYSTEM_ID_3_0, null, null),
GEMFIRE_4_0(CacheXml.VERSION_4_0, CacheXml.PUBLIC_ID_4_0, CacheXml.SYSTEM_ID_4_0, null, null),
GEMFIRE_4_1(CacheXml.VERSION_4_1, CacheXml.PUBLIC_ID_4_1, CacheXml.SYSTEM_ID_4_1, null, null),
@@ -132,7 +133,7 @@ public enum CacheXmlVersion {
* @throws IllegalArgumentException if version does not exist.
* @since GemFire 8.1
*/
- public static final CacheXmlVersion valueForVersion(final String version) {
+ public static CacheXmlVersion valueForVersion(final String version) {
final CacheXmlVersion cacheXmlVersion = valuesForVersion.get(version);
if (null == cacheXmlVersion) {
throw new IllegalArgumentException("No enum constant "
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
index 728cab4..410ca0c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/DefaultEntityResolver2.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache.xmlcache;
import java.io.IOException;
@@ -26,12 +25,12 @@ import org.apache.geode.internal.ClassPathLoader;
/**
* Default behavior for EntityResolver2 implementations.
- *
+ * <p>
+ * UnitTest PivotalEntityResolverJUnitTest and DefaultEntityResolver2Test
*
* @since GemFire 8.1
*/
-// UnitTest PivotalEntityResolverJUnitTest
-abstract public class DefaultEntityResolver2 implements EntityResolver2 {
+public abstract class DefaultEntityResolver2 implements EntityResolver2 {
@Override
public InputSource resolveEntity(final String publicId, final String systemId)
@@ -58,7 +57,7 @@ abstract public class DefaultEntityResolver2 implements EntityResolver2 {
* @return InputSource if resource found, otherwise null.
* @since GemFire 8.1
*/
- protected final InputSource getClassPathInputSource(final String publicId, final String systemId,
+ protected InputSource getClassPathInputSource(final String publicId, final String systemId,
final String path) {
final InputStream stream = ClassPathLoader.getLatest().getResourceAsStream(getClass(), path);
if (null == stream) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
index 3d375ad..71f491c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatArchiveWriter.java
@@ -140,7 +140,7 @@ public class StatArchiveWriter implements StatArchiveFormat, SampleHandler {
*
* @throws GemFireIOException if the archive file could not be closed.
*/
- public final void close() {
+ public void close() {
try {
this.dataOut.flush();
if (this.trace) {
@@ -176,7 +176,7 @@ public class StatArchiveWriter implements StatArchiveFormat, SampleHandler {
* Returns the number of bytes written so far to this archive. This does not take compression into
* account.
*/
- public final long bytesWritten() {
+ public long bytesWritten() {
return this.dataOut.getBytesWritten();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index e59821d..4e450c7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -14,52 +14,82 @@
*/
package org.apache.geode.internal.tcp;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_PEER_AUTH_INIT;
+
import org.apache.geode.CancelException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
-import org.apache.geode.distributed.internal.*;
+import org.apache.geode.distributed.internal.ConflationKey;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DMStats;
+import org.apache.geode.distributed.internal.DirectReplyProcessor;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionConfigImpl;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.DistributionStats;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyMessage;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.ReplySender;
import org.apache.geode.distributed.internal.direct.DirectChannel;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.MembershipManager;
import org.apache.geode.i18n.StringId;
-import org.apache.geode.internal.*;
+import org.apache.geode.internal.Assert;
+import org.apache.geode.internal.ByteArrayDataInput;
+import org.apache.geode.internal.DSFIDFactory;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.SystemTimer;
import org.apache.geode.internal.SystemTimer.SystemTimerTask;
+import org.apache.geode.internal.Version;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingThreadGroup;
import org.apache.geode.internal.logging.log4j.AlertAppender;
import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-import org.apache.geode.internal.net.*;
+import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.tcp.MsgReader.Header;
import org.apache.geode.internal.util.concurrent.ReentrantSemaphore;
import org.apache.logging.log4j.Logger;
-import java.io.*;
-import java.net.*;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.Inet6Address;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ClosedSelectorException;
import java.nio.channels.SocketChannel;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
/**
- * <p>
* Connection is a socket holder that sends and receives serialized message objects. A Connection
* may be closed to preserve system resources and will automatically be reopened when it's needed.
- * </p>
- *
+ *
* @since GemFire 2.0
- *
*/
-
public class Connection implements Runnable {
private static final Logger logger = LogService.getLogger();
@@ -153,6 +183,7 @@ public class Connection implements Runnable {
*/
private static final boolean DOMINO_THREAD_OWNED_SOCKETS =
Boolean.getBoolean("p2p.ENABLE_DOMINO_THREAD_OWNED_SOCKETS");
+
private final static ThreadLocal isDominoThread = new ThreadLocal();
// return true if this thread is a reader thread
@@ -214,22 +245,13 @@ public class Connection implements Runnable {
}
};
- // /**
- // * name of sender thread thread. Useful in finding out why a reader
- // * thread was created. Add sending of the name in handshakes and
- // * add it to the name of the reader thread (the code is there but commented out)
- // */
- // private String senderName = null;
-
- // If we are a sender then we want to know if the receiver on the
- // other end is willing to have its messages queued. The following
- // four "async" inst vars come from his handshake response.
/**
* How long to wait if receiver will not accept a message before we go into queue mode.
*
* @since GemFire 4.2.2
*/
private int asyncDistributionTimeout = 0;
+
/**
* How long to wait, with the receiver not accepting any messages, before kicking the receiver out
* of the distributed system. Ignored if asyncDistributionTimeout is zero.
@@ -237,6 +259,7 @@ public class Connection implements Runnable {
* @since GemFire 4.2.2
*/
private int asyncQueueTimeout = 0;
+
/**
* How much queued data we can have, with the receiver not accepting any messages, before kicking
* the receiver out of the distributed system. Ignored if asyncDistributionTimeout is zero.
@@ -245,6 +268,7 @@ public class Connection implements Runnable {
* @since GemFire 4.2.2
*/
private long asyncMaxQueueSize = 0;
+
/**
* True if an async queue is already being filled.
*/
@@ -256,9 +280,6 @@ public class Connection implements Runnable {
*/
private final Map conflatedKeys = new HashMap();
- // private final Queue outgoingQueue = new LinkedBlockingQueue();
-
-
// NOTE: LinkedBlockingQueue has a bug in which removes from the queue
// cause future offer to increase the size without adding anything to the queue.
// So I've changed from this backport class to a java.util.LinkedList
@@ -298,13 +319,6 @@ public class Connection implements Runnable {
/** message reader thread */
private volatile Thread readerThread;
- // /**
- // * When a thread owns the outLock and is writing to the socket, it must
- // * be placed in this variable so that it can be interrupted should the
- // * socket need to be closed.
- // */
- // private volatile Thread writerThread;
-
/** whether the reader thread is, or should be, running */
volatile boolean stopped = true;
@@ -330,9 +344,6 @@ public class Connection implements Runnable {
*/
private SystemTimer.SystemTimerTask ackTimeoutTask;
- // State for ackTimeoutTask: transmissionStartTime, ackWaitTimeout, ackSATimeout,
- // ackConnectionGroup, ackThreadName
-
/**
* millisecond clock at the time message transmission started, if doing forced-disconnect
* processing
@@ -354,7 +365,6 @@ public class Connection implements Runnable {
/** name of thread that we're currently performing an operation in (may be null) */
String ackThreadName;
-
/** the buffer used for NIO message receipt */
ByteBuffer nioInputBuffer;
@@ -514,7 +524,6 @@ public class Connection implements Runnable {
}
}
c.waitForHandshake();
- // sendHandshakeReplyOK();
c.finishedConnecting = true;
return c;
}
@@ -540,8 +549,6 @@ public class Connection implements Runnable {
try {
socket.setTcpNoDelay(true);
socket.setKeepAlive(true);
- // socket.setSoLinger(true, (Integer.valueOf(System.getProperty("p2p.lingerTime",
- // "5000"))).intValue());
setSendBufferSize(socket, SMALL_BUFFER_SIZE);
setReceiveBufferSize(socket);
} catch (SocketException e) {
@@ -922,17 +929,6 @@ public class Connection implements Runnable {
os.writeLong(this.uniqueId);
Version.CURRENT.writeOrdinal(os, true);
os.writeInt(dominoCount.get() + 1);
- // this writes the sending member + thread name that is stored in senderName
- // on the receiver to show the cause of reader thread creation
- // if (dominoCount.get() > 0) {
- // os.writeUTF(Thread.currentThread().getName());
- // } else {
- // String name = owner.getDM().getConfig().getName();
- // if (name == null) {
- // name = "pid="+OSProcess.getId();
- // }
- // os.writeUTF("["+name+"] "+Thread.currentThread().getName());
- // }
os.flush();
byte[] msg = baos.toByteArray();
@@ -1268,8 +1264,6 @@ public class Connection implements Runnable {
this.socket = channel.socket();
} else {
if (TCPConduit.useSSL) {
- // socket = javax.net.ssl.SSLSocketFactory.getDefault()
- // .createSocket(remoteAddr.getInetAddress(), remoteAddr.getPort());
int socketBufferSize =
sharedResource ? SMALL_BUFFER_SIZE : this.owner.getConduit().tcpBufferSize;
this.socket = owner.getConduit().getSocketCreator().connectForServer(
@@ -3283,7 +3277,7 @@ public class Connection implements Runnable {
* @param forceAsync true if we need to force a blocking async write.
* @throws ConnectionException if the conduit has stopped
*/
- protected final void nioWriteFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync,
+ protected void nioWriteFully(SocketChannel channel, ByteBuffer buffer, boolean forceAsync,
DistributionMessage msg) throws IOException, ConnectionException {
final DMStats stats = this.owner.getConduit().stats;
if (!this.sharedResource) {
@@ -3356,7 +3350,6 @@ public class Connection implements Runnable {
protected static final byte STATE_RECEIVED_ACK = 4;
/** the connection is in use and is reading a message */
protected static final byte STATE_READING = 5;
-
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/** set to true if we exceeded the ack-wait-threshold waiting for a response */
@@ -3378,7 +3371,6 @@ public class Connection implements Runnable {
this.connectionState = STATE_READING_ACK;
}
-
boolean origSocketInUse = this.socketInUse;
this.socketInUse = true;
MsgReader msgReader = null;
@@ -3474,7 +3466,6 @@ public class Connection implements Runnable {
}
}
-
/**
* processes the current NIO buffer. If there are complete messages in the buffer, they are
* deserialized and passed to TCPConduit for further processing
@@ -3916,14 +3907,10 @@ public class Connection implements Runnable {
}
private void setThreadName(int dominoNumber) {
- Thread.currentThread().setName(
- // (!this.sharedResource && this.senderName != null? ("<"+this.senderName+"> ->
- // ") : "") +
- // "[" + name + "] "+
- "P2P message reader for " + this.remoteAddr + " " + (this.sharedResource ? "" : "un")
- + "shared" + " " + (this.preserveOrder ? "" : "un") + "ordered" + " uid="
- + this.uniqueId + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "") + " port="
- + this.socket.getPort());
+ Thread.currentThread().setName("P2P message reader for " + this.remoteAddr + " "
+ + (this.sharedResource ? "" : "un") + "shared" + " " + (this.preserveOrder ? "" : "un")
+ + "ordered" + " uid=" + this.uniqueId + (dominoNumber > 0 ? (" dom #" + dominoNumber) : "")
+ + " port=" + this.socket.getPort());
}
private void compactOrResizeBuffer(int messageLength) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
index ce5ba45..4063457 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/IdentityConverter.java
@@ -21,10 +21,9 @@ import javax.management.openmbean.OpenType;
/**
* Converter for classes where the open data is identical to the original data. This is true for any
* of the SimpleType types, and for an any-dimension array of those
- *
- *
*/
public class IdentityConverter extends OpenTypeConverter {
+
IdentityConverter(Type targetType, OpenType openType, Class openClass) {
super(targetType, openType, openClass);
}
@@ -33,7 +32,7 @@ public class IdentityConverter extends OpenTypeConverter {
return true;
}
- final Object toNonNullOpenValue(Object value) {
+ Object toNonNullOpenValue(Object value) {
return value;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java b/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
index 4fdf291..0fb2b39 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/OpenTypeConverter.java
@@ -76,13 +76,12 @@ import org.apache.geode.management.ManagementException;
*
* Apart from simple types, arrays, and collections, Java types are converted through introspection
* into CompositeType
- *
- *
*/
public abstract class OpenTypeConverter {
private final Type targetType;
- /*
+
+ /**
* The Java class corresponding to getOpenType(). This is the class named by
* getOpenType().getClassName(), except that it may be a primitive type or an array of primitive
* type.
@@ -113,9 +112,7 @@ public abstract class OpenTypeConverter {
/**
* Convert an instance of openClass into an instance of targetType.
*
- * @param value
* @return the java type object
- * @throws InvalidObjectException
*/
public Object fromOpenValue(Object value) throws InvalidObjectException {
if (value == null)
@@ -129,8 +126,6 @@ public abstract class OpenTypeConverter {
/**
* Throw an appropriate InvalidObjectException if we will not be able to convert back from the
* open data to the original Java object.
- *
- * @throws InvalidObjectException
*/
void checkReconstructible() throws InvalidObjectException {
// subclasses can override
@@ -139,9 +134,7 @@ public abstract class OpenTypeConverter {
/**
* Convert an instance of targetType into an instance of openClass.
*
- * @param value
* @return open class object
- * @throws OpenDataException
*/
Object toOpenValue(Object value) throws OpenDataException {
if (value == null)
@@ -153,7 +146,6 @@ public abstract class OpenTypeConverter {
abstract Object toNonNullOpenValue(Object value) throws OpenDataException;
/**
- *
* @return True if and only if this OpenTypeConverter's toOpenValue and fromOpenValue methods are
* the identity function.
*/
@@ -174,8 +166,6 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param type
* @return a converter corresponding to a type
*/
private static synchronized OpenTypeConverter getConverter(Type type) {
@@ -192,9 +182,6 @@ public abstract class OpenTypeConverter {
/**
* Put the converter in the map to avoid future creation
- *
- * @param type
- * @param conv
*/
private static synchronized void putConverter(Type type, OpenTypeConverter conv) {
WeakReference<OpenTypeConverter> wr = new WeakReference<OpenTypeConverter>(conv);
@@ -206,7 +193,7 @@ public abstract class OpenTypeConverter {
preDefinedConverters.add(conv);
}
- /**
+ /*
* Static block to initialize pre defined convertor
*/
static {
@@ -250,10 +237,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param objType
* @return the converter for the given Java type, creating it if necessary
- * @throws OpenDataException
*/
public static synchronized OpenTypeConverter toConverter(Type objType) throws OpenDataException {
@@ -281,10 +265,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param objType
- * @return the open type converrter for a given type
- * @throws OpenDataException
+ * @return the open type converter for a given type
*/
private static OpenTypeConverter makeConverter(Type objType) throws OpenDataException {
@@ -346,6 +327,7 @@ public abstract class OpenTypeConverter {
}
protected static final String[] keyArray = {"key"};
+
protected static final String[] keyValueArray = {"key", "value"};
private static OpenTypeConverter makeTabularConverter(Type objType, boolean sortedMap,
@@ -363,16 +345,14 @@ public abstract class OpenTypeConverter {
}
/**
- * Supprted types are List<E>, Set<E>, SortedSet<E>, Map<K,V>, SortedMap<K,V>.
+ * Supported types are List<E>, Set<E>, SortedSet<E>, Map<K,V>, SortedMap<K,V>.
*
* Subclasses of the above types wont be supported as deserialize info wont be there.
*
* Queue<E> won't be supported as Queue is more of a functional data structure rather than a data
* holder
*
- * @param objType
- * @return the open type converrter for a given type
- * @throws OpenDataException
+ * @return the open type converter for a given type
*/
private static OpenTypeConverter makeParameterizedConverter(ParameterizedType objType)
throws OpenDataException {
@@ -402,10 +382,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param c
* @return the open type converrter for a given type
- * @throws OpenDataException
*/
private static OpenTypeConverter makeCompositeConverter(Class c) throws OpenDataException {
@@ -456,8 +433,6 @@ public abstract class OpenTypeConverter {
/**
* Converts from a CompositeData to an instance of the targetClass Various subclasses override its
* functionality.
- *
- *
*/
protected static abstract class CompositeBuilder {
CompositeBuilder(Class targetClass, String[] itemNames) {
@@ -477,10 +452,8 @@ public abstract class OpenTypeConverter {
* If the subclass should be appropriate but there is a problem, then the method throws
* InvalidObjectException.
*
- * @param getters
* @return If the subclass is appropriate for targetClass, then the method returns null. If the
* subclass is not appropriate, then the method returns an explanation of why not.
- * @throws InvalidObjectException
*/
abstract String applicable(Method[] getters) throws InvalidObjectException;
@@ -493,12 +466,7 @@ public abstract class OpenTypeConverter {
}
/**
- *
- * @param cd
- * @param itemNames
- * @param converters
* @return Actual java types from the composite type
- * @throws InvalidObjectException
*/
abstract Object fromCompositeData(CompositeData cd, String[] itemNames,
OpenTypeConverter[] converters) throws InvalidObjectException;
@@ -509,8 +477,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a method "public static from(CompositeData)"
- *
- *
*/
protected static class CompositeBuilderViaFrom extends CompositeBuilder {
@@ -545,8 +511,8 @@ public abstract class OpenTypeConverter {
}
}
- final Object fromCompositeData(CompositeData cd, String[] itemNames,
- OpenTypeConverter[] converters) throws InvalidObjectException {
+ Object fromCompositeData(CompositeData cd, String[] itemNames, OpenTypeConverter[] converters)
+ throws InvalidObjectException {
try {
return fromMethod.invoke(null, cd);
} catch (Exception e) {
@@ -566,8 +532,6 @@ public abstract class OpenTypeConverter {
* are candidate builders. Instead, the "applicable" method will return an explanatory string, and
* the other builders will be skipped. If all the getters are OK, then the "applicable" method
* will return an empty string and the other builders will be tried.
- *
- *
*/
protected static class CompositeBuilderCheckGetters extends CompositeBuilder {
CompositeBuilderCheckGetters(Class targetClass, String[] itemNames,
@@ -604,8 +568,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a setter for every getter
- *
- *
*/
protected static class CompositeBuilderViaSetters extends CompositeBuilder {
@@ -664,8 +626,6 @@ public abstract class OpenTypeConverter {
/**
* Builder if the target class has a constructor that is annotated with @ConstructorProperties so
* we can derive the corresponding getters.
- *
- *
*/
protected static class CompositeBuilderViaConstructor extends CompositeBuilder {
@@ -848,8 +808,6 @@ public abstract class OpenTypeConverter {
* Builder if the target class is an interface and contains no methods other than getters. Then we
* can make an instance using a dynamic proxy that forwards the getters to the source
* CompositeData
- *
- *
*/
protected static class CompositeBuilderViaProxy extends CompositeBuilder {
@@ -882,8 +840,7 @@ public abstract class OpenTypeConverter {
return null;
}
- final Object fromCompositeData(CompositeData cd, String[] itemNames,
- OpenTypeConverter[] converters) {
+ Object fromCompositeData(CompositeData cd, String[] itemNames, OpenTypeConverter[] converters) {
final Class targetClass = getTargetClass();
return Proxy.newProxyInstance(targetClass.getClassLoader(), new Class[] {targetClass},
new CompositeDataInvocationHandler(cd));
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
index fd9461f..107ac0b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/TypedJson.java
@@ -42,8 +42,6 @@ import org.apache.geode.pdx.PdxInstance;
*
* Although it has limited functionality,still a simple use of add() method should suffice for most
* of the simple JSON use cases.
- *
- *
*/
public class TypedJson {
@@ -137,7 +135,6 @@ public class TypedJson {
}
}
-
}
}
}
@@ -150,9 +147,7 @@ public class TypedJson {
}
}
-
/**
- *
* User can build on this object by adding Objects against a key.
*
* TypedJson result = new TypedJson(); result.add(KEY,object); If users add more objects against
@@ -218,7 +213,6 @@ public class TypedJson {
commanate = false;
addComma = true;
}
-
}
writer.write('}');
@@ -312,7 +306,7 @@ public class TypedJson {
return false;
}
- final void writeVal(Writer w, Object value) throws IOException {
+ void writeVal(Writer w, Object value) throws IOException {
w.write('{');
addVal(w, value);
w.write('}');
@@ -325,7 +319,6 @@ public class TypedJson {
if (shouldVisitChildren(object)) {
visitChildrens(w, object, true);
}
-
}
void writeKeyValue(Writer w, Object key, Object value, Class type) throws IOException {
@@ -379,7 +372,6 @@ public class TypedJson {
}
void writeArray(Writer w, Object object) throws IOException {
-
if (commanate) {
w.write(",");
}
@@ -419,7 +411,6 @@ public class TypedJson {
for (int i = 0; i < length && elements < queryCollectionsDepth; i += 1) {
Object item = Array.get(object, i);
items.add(item);
-
}
return items;
}
@@ -463,7 +454,6 @@ public class TypedJson {
endType(w, rootClazz);
} catch (IOException e) {
}
-
}
void startKey(Writer writer, String key) throws IOException {
@@ -478,7 +468,6 @@ public class TypedJson {
if (key != null) {
writer.write('}');
}
-
}
List<Object> visitSpecialObjects(Writer w, Object object, boolean write) throws IOException {
@@ -563,8 +552,6 @@ public class TypedJson {
} else {
elements.add(fieldValue);
}
-
-
}
if (write)
w.write('}');
@@ -593,7 +580,6 @@ public class TypedJson {
return elements;
}
-
if (object instanceof Region.Entry) {
Region.Entry entry = (Region.Entry) object;
Object key = entry.getKey();
@@ -608,11 +594,9 @@ public class TypedJson {
elements.add(value);
}
-
return elements;
}
-
return elements;
}
@@ -627,7 +611,6 @@ public class TypedJson {
/**
* Handle some special GemFire classes. We don't want to expose some of the internal classes.
* Hence corresponding interface or external classes should be shown.
- *
*/
String internalToExternal(Class clazz, Object value) {
if (value != null && value instanceof Region.Entry) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
index 3ec04c7..0dbd5f3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/domain/Link.java
@@ -77,7 +77,7 @@ public class Link implements Comparable<Link>, Serializable {
return href;
}
- public final void setHref(final URI href) {
+ public void setHref(final URI href) {
assert href != null : "The Link href URI cannot be null!";
this.href = href;
}
@@ -87,7 +87,7 @@ public class Link implements Comparable<Link>, Serializable {
return method;
}
- public final void setMethod(final HttpMethod method) {
+ public void setMethod(final HttpMethod method) {
this.method = ObjectUtils.defaultIfNull(method, DEFAULT_HTTP_METHOD);
}
@@ -96,7 +96,7 @@ public class Link implements Comparable<Link>, Serializable {
return relation;
}
- public final void setRelation(final String relation) {
+ public void setRelation(final String relation) {
assert StringUtils.isNotBlank(relation) : "The Link relation (rel) must be specified!";
this.relation = relation;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
index ea9c81c..43657b9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/web/http/ClientHttpRequest.java
@@ -117,7 +117,7 @@ public class ClientHttpRequest implements HttpRequest {
* @return the Link encapsulating the URI and method for the client's HTTP request.
* @see org.apache.geode.management.internal.web.domain.Link
*/
- public final Link getLink() {
+ public Link getLink() {
return link;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
index 0eb6dca..716c3f4 100755
--- a/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/redis/internal/executor/AbstractScanExecutor.java
@@ -20,7 +20,6 @@ import java.util.regex.Pattern;
import org.apache.geode.redis.internal.org.apache.hadoop.fs.GlobPattern;
-
public abstract class AbstractScanExecutor extends AbstractExecutor {
protected final String ERROR_CURSOR = "Invalid cursor";
@@ -39,9 +38,10 @@ public abstract class AbstractScanExecutor extends AbstractExecutor {
* @param pattern A glob pattern.
* @return A regex pattern to recognize the given glob pattern.
*/
- protected final Pattern convertGlobToRegex(String pattern) {
- if (pattern == null)
+ protected Pattern convertGlobToRegex(String pattern) {
+ if (pattern == null) {
return null;
+ }
return GlobPattern.compile(pattern);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java b/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
new file mode 100644
index 0000000..e550981
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/DataSerializerTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DataSerializerTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DataSerializer mockDataSerializer = mock(DataSerializer.class);
+ EventID mockEventID = mock(EventID.class);
+ ClientProxyMembershipID mockClientProxyMembershipID = mock(ClientProxyMembershipID.class);
+
+ when(mockDataSerializer.getEventId()).thenReturn(mockEventID);
+ when(mockDataSerializer.getContext()).thenReturn(mockClientProxyMembershipID);
+
+ mockDataSerializer.setEventId(mockEventID);
+ mockDataSerializer.setContext(mockClientProxyMembershipID);
+
+ verify(mockDataSerializer, times(1)).setEventId(mockEventID);
+ verify(mockDataSerializer, times(1)).setContext(mockClientProxyMembershipID);
+
+ assertThat(mockDataSerializer.getEventId()).isSameAs(mockEventID);
+ assertThat(mockDataSerializer.getContext()).isSameAs(mockClientProxyMembershipID);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java b/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
new file mode 100644
index 0000000..6a20872
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/InstantiatorTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.EventID;
+import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class InstantiatorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ Instantiator mockInstantiator = mock(Instantiator.class);
+ EventID mockEventID = mock(EventID.class);
+ ClientProxyMembershipID mockClientProxyMembershipID = mock(ClientProxyMembershipID.class);
+
+ when(mockInstantiator.getInstantiatedClass()).thenReturn(null);
+ when(mockInstantiator.getId()).thenReturn(0);
+ when(mockInstantiator.getEventId()).thenReturn(mockEventID);
+ when(mockInstantiator.getContext()).thenReturn(mockClientProxyMembershipID);
+
+ mockInstantiator.setEventId(mockEventID);
+ mockInstantiator.setContext(mockClientProxyMembershipID);
+
+ verify(mockInstantiator, times(1)).setEventId(mockEventID);
+ verify(mockInstantiator, times(1)).setContext(mockClientProxyMembershipID);
+
+ assertThat(mockInstantiator.getEventId()).isSameAs(mockEventID);
+ assertThat(mockInstantiator.getContext()).isSameAs(mockClientProxyMembershipID);
+ assertThat(mockInstantiator.getInstantiatedClass()).isNull();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java b/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
new file mode 100644
index 0000000..10c0beb
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/admin/RegionSubRegionSnapshotTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.admin;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Collections;
+
+@Category(UnitTest.class)
+public class RegionSubRegionSnapshotTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ RegionSubRegionSnapshot mockRegionSubRegionSnapshot = mock(RegionSubRegionSnapshot.class);
+ RegionSubRegionSnapshot mockRegionSubRegionSnapshotParent = mock(RegionSubRegionSnapshot.class);
+
+ when(mockRegionSubRegionSnapshot.getEntryCount()).thenReturn(0);
+ when(mockRegionSubRegionSnapshot.getName()).thenReturn("name");
+ when(mockRegionSubRegionSnapshot.getSubRegionSnapshots()).thenReturn(Collections.emptySet());
+ when(mockRegionSubRegionSnapshot.getParent()).thenReturn(mockRegionSubRegionSnapshotParent);
+
+ mockRegionSubRegionSnapshot.setEntryCount(1);
+ mockRegionSubRegionSnapshot.setName("NAME");
+ mockRegionSubRegionSnapshot.setSubRegionSnapshots(null);
+ mockRegionSubRegionSnapshot.setParent(null);
+
+ verify(mockRegionSubRegionSnapshot, times(1)).setEntryCount(1);
+ verify(mockRegionSubRegionSnapshot, times(1)).setName("NAME");
+ verify(mockRegionSubRegionSnapshot, times(1)).setSubRegionSnapshots(null);
+ verify(mockRegionSubRegionSnapshot, times(1)).setParent(null);
+
+ assertThat(mockRegionSubRegionSnapshot.getEntryCount()).isEqualTo(0);
+ assertThat(mockRegionSubRegionSnapshot.getName()).isEqualTo("name");
+ assertThat(mockRegionSubRegionSnapshot.getSubRegionSnapshots())
+ .isEqualTo(Collections.emptySet());
+ assertThat(mockRegionSubRegionSnapshot.getParent()).isSameAs(mockRegionSubRegionSnapshotParent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
index 18af019..b81c08f 100755
--- a/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/ConnectionPoolFactoryJUnitTest.java
@@ -106,7 +106,7 @@ public class ConnectionPoolFactoryJUnitTest {
}
@Test
- public final void testCreateDefaultAndInvalidAndLegitAttributes() {
+ public void testCreateDefaultAndInvalidAndLegitAttributes() {
PoolFactory cpf = PoolManager.createFactory();
((PoolFactoryImpl) cpf).setStartDisabled(true);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java b/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
new file mode 100644
index 0000000..31019f7
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/DiskAccessExceptionTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DiskAccessExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DiskAccessException mockDiskAccessException = mock(DiskAccessException.class);
+ when(mockDiskAccessException.isRemote()).thenReturn(true);
+ assertThat(mockDiskAccessException.isRemote()).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
new file mode 100644
index 0000000..ef1f514
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AbstractOpTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.client.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tier.sockets.Message;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractOpTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractOp mockAbstractOp = mock(AbstractOp.class);
+ Object mockObject = mock(Object.class);
+ when(mockAbstractOp.processObjResponse(any(), anyString())).thenReturn(mockObject);
+ assertThat(mockAbstractOp.processObjResponse(mock(Message.class), "string"))
+ .isEqualTo(mockObject);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
new file mode 100644
index 0000000..daa90ba
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionExceptionTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.execute;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class FunctionExceptionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ FunctionException mockFunctionException = mock(FunctionException.class);
+ Exception cause = new Exception();
+ List<Exception> exceptions = new ArrayList<>();
+ exceptions.add(cause);
+
+ when(mockFunctionException.getExceptions()).thenReturn(Collections.emptyList());
+
+ mockFunctionException.addException(cause);
+ mockFunctionException.addExceptions(exceptions);
+
+ verify(mockFunctionException, times(1)).addException(cause);
+ verify(mockFunctionException, times(1)).addExceptions(exceptions);
+
+ assertThat(mockFunctionException.getExceptions()).isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
index 9655ab4..7a106b5 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/functional/PdxOrderByJUnitTest.java
@@ -195,7 +195,7 @@ public class PdxOrderByJUnitTest {
}
- final public Region createRegion(String name, String rootName, RegionAttributes attrs)
+ public Region createRegion(String name, String rootName, RegionAttributes attrs)
throws CacheException {
Region root = getRootRegion(rootName);
if (root == null) {
@@ -220,11 +220,11 @@ public class PdxOrderByJUnitTest {
return root.createSubregion(name, attrs);
}
- public final Region getRootRegion(String rootName) {
+ public Region getRootRegion(String rootName) {
return CacheUtils.getRegion(rootName);
}
- public final Region createRootRegion(String rootName, RegionAttributes attrs)
+ public Region createRootRegion(String rootName, RegionAttributes attrs)
throws RegionExistsException, TimeoutException {
return ((GemFireCacheImpl) CacheUtils.getCache()).createRegion(rootName, attrs);
}
[07/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
index 0b11bf1..388f838 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HandShake.java
@@ -14,7 +14,49 @@
*/
package org.apache.geode.internal.cache.tier.sockets;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CONFLATE_EVENTS;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTHENTICATOR;
+import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTH_INIT;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.InternalGemFireException;
+import org.apache.geode.cache.GatewayConfigurationException;
+import org.apache.geode.cache.client.PoolFactory;
+import org.apache.geode.cache.client.ServerRefusedConnectionException;
+import org.apache.geode.cache.client.internal.Connection;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.LonerDistributionManager;
+import org.apache.geode.distributed.internal.ServerLocation;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.ClassLoadUtil;
+import org.apache.geode.internal.HeapDataOutputStream;
+import org.apache.geode.internal.InternalDataSerializer;
+import org.apache.geode.internal.InternalInstantiator;
+import org.apache.geode.internal.Version;
+import org.apache.geode.internal.VersionedDataInputStream;
+import org.apache.geode.internal.VersionedDataOutputStream;
+import org.apache.geode.internal.cache.tier.Acceptor;
+import org.apache.geode.internal.cache.tier.ClientHandShake;
+import org.apache.geode.internal.cache.tier.ConnectionProxy;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.InternalLogWriter;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.security.IntegratedSecurityService;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.geode.security.AuthInitialize;
+import org.apache.geode.security.AuthenticationFailedException;
+import org.apache.geode.security.AuthenticationRequiredException;
+import org.apache.geode.security.Authenticator;
+import org.apache.geode.security.GemFireSecurityException;
+import org.apache.logging.log4j.Logger;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -49,7 +91,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-
import javax.crypto.Cipher;
import javax.crypto.KeyAgreement;
import javax.crypto.SecretKey;
@@ -58,46 +99,6 @@ import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLSocket;
-import org.apache.geode.CancelCriterion;
-import org.apache.geode.DataSerializer;
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.InternalGemFireException;
-import org.apache.geode.cache.GatewayConfigurationException;
-import org.apache.geode.cache.client.PoolFactory;
-import org.apache.geode.cache.client.ServerRefusedConnectionException;
-import org.apache.geode.cache.client.internal.Connection;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.distributed.internal.LonerDistributionManager;
-import org.apache.geode.distributed.internal.ServerLocation;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.ClassLoadUtil;
-import org.apache.geode.internal.HeapDataOutputStream;
-import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.InternalInstantiator;
-import org.apache.geode.internal.Version;
-import org.apache.geode.internal.VersionedDataInputStream;
-import org.apache.geode.internal.VersionedDataOutputStream;
-import org.apache.geode.internal.cache.tier.Acceptor;
-import org.apache.geode.internal.cache.tier.ClientHandShake;
-import org.apache.geode.internal.cache.tier.ConnectionProxy;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.InternalLogWriter;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.security.IntegratedSecurityService;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.pdx.internal.PeerTypeRegistration;
-import org.apache.geode.security.AuthInitialize;
-import org.apache.geode.security.AuthenticationFailedException;
-import org.apache.geode.security.AuthenticationRequiredException;
-import org.apache.geode.security.Authenticator;
-import org.apache.geode.security.GemFireSecurityException;
-import org.apache.logging.log4j.Logger;
-
public class HandShake implements ClientHandShake {
private static final Logger logger = LogService.getLogger();
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
index 499d546..8a44564 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/StringUtils.java
@@ -22,91 +22,30 @@ import org.apache.geode.internal.cache.Token;
* The StringUtils is an abstract utility class for working with and invoking operations on String
* literals.
* <p/>
- *
+ *
* @see java.lang.String
* @since GemFire 7.0
*/
@SuppressWarnings("unused")
-public abstract class StringUtils {
+@Deprecated
+public class StringUtils extends org.apache.commons.lang.StringUtils {
public static final String COMMA_DELIMITER = ",";
- public static final String EMPTY_STRING = "";
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String SPACE = " ";
- public static final String UTF_8 = "UTF-8";
-
- public static final String[] EMPTY_STRING_ARRAY = new String[0];
- public static final String[] SPACES = {"", " ", " ", " ", " ", " ", " ", " ",
- " ", " ", " "};
-
- /**
- * Concatenates all Objects in the array into a single String by calling toString on the Object.
- * </p>
- *
- * @param values the Object elements of the array to be concatenated into the String.
- * @return a single String with all the individual Objects in the array concatenated.
- * @see #concat(Object[], String)
- */
- public static String concat(final Object... values) {
- return concat(values, EMPTY_STRING);
- }
-
- /**
- * Concatenates all Objects in the array into a single String using the Object's toString method,
- * delimited by the specified delimiter.
- * </p>
- *
- * @param values an array of Objects to concatenate into a single String value.
- * @param delimiter the String value to use as a separator between the individual Object values.
- * If delimiter is null, then a empty String is used.
- * @return a single String with all the individual Objects of the array concatenated together,
- * separated by the specified delimiter.
- * @see java.lang.Object#toString()
- * @see java.lang.StringBuilder
- */
- public static String concat(final Object[] values, String delimiter) {
- delimiter = ObjectUtils.defaultIfNull(delimiter, EMPTY_STRING);
-
- final StringBuilder buffer = new StringBuilder();
- int count = 0;
-
- if (values != null) {
- for (Object value : values) {
- buffer.append(count++ > 0 ? delimiter : EMPTY_STRING);
- buffer.append(value);
- }
- }
-
- return buffer.toString();
- }
+ private static final int MAX_ARRAY_ELEMENTS_TO_CONVERT =
+ Integer.getInteger("StringUtils.MAX_ARRAY_ELEMENTS_TO_CONVERT", 16);
- /**
- * Returns the first non-null, non-empty and non-blank String value in the array of String values.
- * </p>
- *
- * @param values an array of String values, usually consisting of the preferred value followed by
- * default values if any value in the array of String values is null, empty or blank.
- * @return the first non-null, non-empty and non-blank String value in the array of Strings. If
- * all values are either null, empty or blank then null is returned.
- * @see #isBlank(String)
- */
- public static String defaultIfBlank(final String... values) {
- if (values != null) {
- for (final String value : values) {
- if (!isBlank(value)) {
- return value;
- }
- }
- }
- return null;
+ public static String nullifyIfBlank(final String value) {
+ return isBlank(value) ? null : value;
}
/**
* Returns only the digits (0..9) from the specified String value.
* </p>
- *
+ *
* @param value the String value from which to extract digits.
* @return only the digits from the specified String value. If the String is null or contains no
* digits, then this method returns an empty String.
@@ -126,156 +65,7 @@ public abstract class StringUtils {
return buffer.toString();
}
- /**
- * Returns only the letters (a..zA..Z) from the specified String value.
- * </p>
- *
- * @param value the String value from which to extract letters.
- * @return only the letters from the specified String value. If the String is null or contains no
- * letters, then this method returns an empty String.
- * @see java.lang.Character#isLetter(char)
- */
- public static String getLettersOnly(final String value) {
- final StringBuilder buffer = new StringBuilder();
-
- if (value != null) {
- for (final char chr : value.toCharArray()) {
- if (Character.isLetter(chr)) {
- buffer.append(chr);
- }
- }
- }
-
- return buffer.toString();
- }
-
- /**
- * Gets a number of spaces determined by number.
- * </p>
- *
- * @param number an integer value indicating the number of spaces to return.
- * @return a String value containing a number of spaces given by number.
- */
- public static String getSpaces(int number) {
- final StringBuilder spaces = new StringBuilder(SPACES[Math.min(number, SPACES.length - 1)]);
-
- do {
- number -= (SPACES.length - 1);
- number = Math.max(number, 0);
- spaces.append(SPACES[Math.min(number, SPACES.length - 1)]);
- } while (number > 0);
-
- return spaces.toString();
- }
-
- /**
- * Determines whether the specified String value is blank, which is true if it is null, an empty
- * String or a String containing only spaces (blanks).
- * </p>
- *
- * @param value the String value used in the determination for the "blank" check.
- * @return a boolean value indicating whether the specified String is blank.
- * @see #isEmpty(String)
- */
- public static boolean isBlank(final String value) {
- return (value == null || EMPTY_STRING.equals(value.trim()));
- }
-
- /**
- * Determines whether the specified String value is empty, which is true if and only if the value
- * is the empty String.
- * </p>
- *
- * @param value the String value used in the determination of the "empty" check.
- * @return a boolean value indicating if the specified String is empty.
- * @see #isBlank(String)
- */
- public static boolean isEmpty(final String value) {
- return EMPTY_STRING.equals(value);
- }
-
- /**
- * Pads the specified String value by appending the specified character up to the given length.
- * </p>
- *
- * @param value the String value to pad by appending 'paddingCharacter' to the end.
- * @param paddingCharacter the character used to pad the end of the String value.
- * @param length an int value indicating the final length of the String value with padding of the
- * 'paddingCharacter'.
- * @return the String value padded with the specified character by appending 'paddingCharacter' to
- * the end of the String value up to the given length.
- * @throws NullPointerException if the String value is null.
- */
- public static String padEnding(final String value, final char paddingCharacter,
- final int length) {
- if (value == null) {
- throw new NullPointerException("The String value to pad cannot be null!");
- }
-
- final StringBuilder buffer = new StringBuilder(value);
-
- for (int valueLength = value.length(); valueLength < length; valueLength++) {
- buffer.append(paddingCharacter);
- }
-
- return buffer.toString();
- }
-
- /**
- * A null-safe implementation of the String.toLowerCase method.
- * </p>
- *
- * @param value a String value to convert to lower case.
- * @return a lower case representation of the specified String value.
- * @see java.lang.String#toLowerCase()
- */
- public static String toLowerCase(final String value) {
- return (value == null ? null : value.toLowerCase());
- }
-
- /**
- * A null-safe implementation of the String.toUpperCase method.
- * </p>
- *
- * @param value a String value to convert to upper case.
- * @return an upper case representation of the specified String value.
- * @see java.lang.String#toUpperCase()
- */
- public static String toUpperCase(final String value) {
- return (value == null ? null : value.toUpperCase());
- }
- /**
- * A method to trim the value of a String and guard against null values.
- * <p/>
- *
- * @param value the String value that will be trimmed if not null.
- * @return null if the String value is null or the trimmed version of the String value if String
- * value is not null.
- * @see java.lang.String#trim()
- */
- public static String trim(final String value) {
- return (value == null ? null : value.trim());
- }
-
- /**
- * Null-safe implementation of String truncate using substring. Truncates the specified String
- * value to the specified length. Returns null if the String value is null.
- * </p>
- *
- * @param value the String value to truncate.
- * @param length an int value indicating the length to truncate the String value to.
- * @return the String value truncated to specified length, or null if the String value is null.
- * @throws IllegalArgumentException if the value of length is less than 0.
- * @see java.lang.String#substring(int, int)
- */
- public static String truncate(final String value, final int length) {
- if (length < 0) {
- throw new IllegalArgumentException("Length must be greater than equal to 0!");
- }
-
- return (value == null ? null : value.substring(0, Math.min(value.length(), length)));
- }
/**
* Gets the value of the specified Object as a String. If the Object is null then the first
@@ -283,9 +73,9 @@ public abstract class StringUtils {
* String values is null or all the elements in the default String values array are null, then the
* value of String.valueOf(value) is returned.
* </p>
- *
+ *
* @param value the Object who's String representation is being evaluated.
- * @param defaultValues an array of default String values to assess if the specified Object value
+ * @param defaultValue an array of default String values to assess if the specified Object value
* is null.
* @return a String representation of the specified Object value or one of the default String
* values from the array if the Object value is null. If either the default String array
@@ -293,20 +83,12 @@ public abstract class StringUtils {
* returned.
* @see java.lang.String#valueOf(Object)
*/
- public static String valueOf(final Object value, final String... defaultValues) {
- if (value != null) {
- return value.toString();
- } else {
- if (defaultValues != null) {
- for (String defaultValue : defaultValues) {
- if (defaultValue != null) {
- return defaultValue;
- }
- }
- }
+ public static String defaultString(final Object value, final String defaultValue) {
+ return value == null ? defaultValue : value.toString();
+ }
- return String.valueOf(value);
- }
+ public static String defaultString(final Object value) {
+ return value == null ? EMPTY : value.toString();
}
/**
@@ -314,7 +96,7 @@ public abstract class StringUtils {
* characters in each line, indenting all subsequent lines with the indent. If the indent is null,
* then an empty String is used.
* </p>
- *
+ *
* @param line a String containing the line of text to wrap.
* @param widthInCharacters an integer value indicating the width of each line measured by the
* number of characters.
@@ -324,18 +106,19 @@ public abstract class StringUtils {
* boundaries within the given width on any given split.
* @throws NullPointerException if the line of text is null.
*/
+ // Can be removed when commons is updated.
public static String wrap(String line, final int widthInCharacters, String indent) {
final StringBuilder buffer = new StringBuilder();
int lineCount = 1;
- int spaceIndex = -1;
+ int spaceIndex;
// if indent is null, then do not indent the wrapped lines
- indent = valueOf(indent, EMPTY_STRING);
+ indent = StringUtils.defaultString(indent);
while (line.length() > widthInCharacters) {
spaceIndex = line.substring(0, widthInCharacters).lastIndexOf(SPACE);
- buffer.append(lineCount++ > 1 ? indent : EMPTY_STRING);
+ buffer.append(lineCount++ > 1 ? indent : EMPTY);
// throws IndexOutOfBoundsException if spaceIndex is -1, implying no word boundary was found
// within
// the given width; this also avoids the infinite loop
@@ -351,13 +134,10 @@ public abstract class StringUtils {
return buffer.toString();
}
- private static final int MAX_ARRAY_ELEMENTS_TO_CONVERT =
- Integer.getInteger("StringUtils.MAX_ARRAY_ELEMENTS_TO_CONVERT", 16);
-
/**
* Used to convert the given object to a String. If anything goes wrong in this conversion put
* some info about what went wrong on the result string but do not throw an exception.
- *
+ *
* @param o the object to convert to a string
* @return the string from of the given object.
*/
@@ -373,7 +153,7 @@ public abstract class StringUtils {
* Convert an object to a string and return it. Handled CacheDeserializables without having them
* change the form they store. If deserialization is needed and fails then the string contains a
* message saying so instead of throwing an exception.
- *
+ *
* @param o the object to convert to a string
* @param convertArrayContents if true then the contents of the array will be in the string;
* otherwise just the array identity
@@ -414,13 +194,15 @@ public abstract class StringUtils {
}
}
- private static String arrayToString(Object[] a, int maxArrayElements) {
+
+ private static <T> String arrayToString(T[] a, int maxArrayElements) {
if (maxArrayElements < 0) {
maxArrayElements = 0;
}
if (a == null) {
return "null";
}
+ String className = a.getClass().getSimpleName();
int iMax = a.length;
if (iMax > maxArrayElements) {
iMax = maxArrayElements;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
index 2e47556..4c50851 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemUtils.java
@@ -80,8 +80,8 @@ public class SystemUtils {
actualVersionDigits = StringUtils.getDigitsOnly(System.getProperty("java.version"));
}
- String expectedVersionDigits = StringUtils.padEnding(StringUtils.getDigitsOnly(expectedVersion),
- '0', actualVersionDigits.length());
+ String expectedVersionDigits = StringUtils.rightPad(StringUtils.getDigitsOnly(expectedVersion),
+ actualVersionDigits.length(), '0');
try {
return Long.parseLong(actualVersionDigits) >= Long.parseLong(expectedVersionDigits);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
index 629740c..c8ec49d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/process/FileProcessController.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.process;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
@@ -101,8 +102,7 @@ public class FileProcessController implements ProcessController {
LocalizedStrings.Launcher_ATTACH_API_NOT_FOUND_ERROR_MESSAGE.toLocalizedString());
}
- private void stop(final File workingDir, final String stopRequestFileName)
- throws UnableToControlProcessException, IOException {
+ private void stop(final File workingDir, final String stopRequestFileName) throws IOException {
final File stopRequestFile = new File(workingDir, stopRequestFileName);
if (!stopRequestFile.exists()) {
stopRequestFile.createNewFile();
@@ -110,11 +110,10 @@ public class FileProcessController implements ProcessController {
}
private String status(final File workingDir, final String statusRequestFileName,
- final String statusFileName)
- throws UnableToControlProcessException, IOException, InterruptedException, TimeoutException {
+ final String statusFileName) throws IOException, InterruptedException, TimeoutException {
// monitor for statusFile
final File statusFile = new File(workingDir, statusFileName);
- final AtomicReference<String> statusRef = new AtomicReference<String>();
+ final AtomicReference<String> statusRef = new AtomicReference<>();
final ControlRequestHandler statusHandler = new ControlRequestHandler() {
@Override
@@ -162,7 +161,7 @@ public class FileProcessController implements ProcessController {
}
final String lines = statusRef.get();
- if (null == lines || lines.trim().isEmpty()) {
+ if (StringUtils.isBlank(lines)) {
throw new IllegalStateException("Failed to read status file");
}
return lines;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
index faab4ed..78b19db 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/process/signal/Signal.java
@@ -15,7 +15,7 @@
package org.apache.geode.internal.process.signal;
-import org.apache.geode.internal.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
/**
* Signals defined in the enumerated type were based on Open BSD and the IBM JVM...
@@ -78,7 +78,7 @@ public enum Signal {
private final String name;
Signal(final int number, final String name, final SignalType type, final String description) {
- assertValidArgument(!StringUtils.isBlank(name), "The name of the signal must be specified!");
+ assertValidArgument(StringUtils.isNotBlank(name), "The name of the signal must be specified!");
this.number = number;
this.name = name;
this.type = type;
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
index 8366930..600d546 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/security/IntegratedSecurityService.java
@@ -293,7 +293,7 @@ public class IntegratedSecurityService implements SecurityService {
String clientAuthenticatorConfig = securityProps.getProperty(SECURITY_CLIENT_AUTHENTICATOR);
String peerAuthenticatorConfig = securityProps.getProperty(SECURITY_PEER_AUTHENTICATOR);
- if (!StringUtils.isBlank(shiroConfig)) {
+ if (StringUtils.isNotBlank(shiroConfig)) {
IniSecurityManagerFactory factory = new IniSecurityManagerFactory("classpath:" + shiroConfig);
// we will need to make sure that shiro uses a case sensitive permission resolver
@@ -311,20 +311,20 @@ public class IntegratedSecurityService implements SecurityService {
isPeerAuthenticator = false;
}
// only set up shiro realm if user has implemented SecurityManager
- else if (!StringUtils.isBlank(securityManagerConfig)) {
+ else if (StringUtils.isNotBlank(securityManagerConfig)) {
SecurityManager securityManager = SecurityService
.getObjectOfTypeFromClassName(securityManagerConfig, SecurityManager.class);
securityManager.init(securityProps);
this.setSecurityManager(securityManager);
} else {
isIntegratedSecurity = null;
- isClientAuthenticator = !StringUtils.isBlank(clientAuthenticatorConfig);
- isPeerAuthenticator = !StringUtils.isBlank(peerAuthenticatorConfig);
+ isClientAuthenticator = StringUtils.isNotBlank(clientAuthenticatorConfig);
+ isPeerAuthenticator = StringUtils.isNotBlank(peerAuthenticatorConfig);
}
// this initializes the post processor
String customPostProcessor = securityProps.getProperty(SECURITY_POST_PROCESSOR);
- if (!StringUtils.isBlank(customPostProcessor)) {
+ if (StringUtils.isNotBlank(customPostProcessor)) {
postProcessor =
SecurityService.getObjectOfTypeFromClassName(customPostProcessor, PostProcessor.class);
postProcessor.init(securityProps);
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
index 6f1c7cc..6f1292a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java
@@ -15,15 +15,12 @@
package org.apache.geode.internal.util;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.internal.offheap.annotations.Unretained;
+
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.List;
-import java.util.Objects;
-import java.util.RandomAccess;
-
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.offheap.annotations.Unretained;
/**
*
@@ -82,7 +79,7 @@ public abstract class ArrayUtils {
if (array != null) {
for (final Object element : array) {
- buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY_STRING).append(element);
+ buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(element);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
index c1a1952..031f827 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/util/IOUtils.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.internal.util;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.internal.lang.ObjectUtils;
-import org.apache.geode.internal.lang.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -186,7 +186,7 @@ public abstract class IOUtils {
public static String getFilename(final String pathname) {
String filename = pathname;
- if (!StringUtils.isBlank(filename)) {
+ if (StringUtils.isNotBlank(filename)) {
final int index = filename.lastIndexOf(File.separator);
filename = (index == -1 ? filename : filename.substring(index + 1));
}
@@ -205,7 +205,7 @@ public abstract class IOUtils {
* @see java.io.File#exists()
*/
public static boolean isExistingPathname(final String pathname) {
- return (!StringUtils.isBlank(pathname) && new File(pathname).exists());
+ return (StringUtils.isNotBlank(pathname) && new File(pathname).exists());
}
/**
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
index ba15508..3bd442a 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/AgentUtil.java
@@ -15,8 +15,8 @@
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
@@ -53,7 +53,7 @@ public class AgentUtil {
*/
public String findWarLocation(String warFilePrefix) {
String geodeHome = getGeodeHome();
- if (!StringUtils.isBlank(geodeHome)) {
+ if (StringUtils.isNotBlank(geodeHome)) {
String[] possibleFiles =
{geodeHome + "/tools/Extensions/" + warFilePrefix + "-" + gemfireVersion + ".war",
geodeHome + "/tools/Pulse/" + warFilePrefix + "-" + gemfireVersion + ".war",
@@ -91,7 +91,7 @@ public class AgentUtil {
}
public boolean isWebApplicationAvailable(final String warFileLocation) {
- return !StringUtils.isBlank(warFileLocation);
+ return StringUtils.isNotBlank(warFileLocation);
}
public boolean isWebApplicationAvailable(final String... warFileLocations) {
@@ -124,6 +124,6 @@ public class AgentUtil {
public boolean isGemfireHomeDefined() {
String gemfireHome = getGeodeHome();
- return !StringUtils.isBlank(gemfireHome);
+ return StringUtils.isNotBlank(gemfireHome);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
index 7c26297..92987cb 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/JettyHelper.java
@@ -14,9 +14,10 @@
*/
package org.apache.geode.management.internal;
-import java.io.File;
-import java.util.concurrent.CountDownLatch;
-
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.internal.admin.SSLConfig;
+import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.Connector;
@@ -30,10 +31,8 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.webapp.WebAppContext;
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.internal.admin.SSLConfig;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
/**
* @since GemFire 8.1
@@ -70,13 +69,13 @@ public class JettyHelper {
if (sslConfig.isEnabled()) {
SslContextFactory sslContextFactory = new SslContextFactory();
- if (!StringUtils.isBlank(sslConfig.getAlias())) {
+ if (StringUtils.isNotBlank(sslConfig.getAlias())) {
sslContextFactory.setCertAlias(sslConfig.getAlias());
}
sslContextFactory.setNeedClientAuth(sslConfig.isRequireAuth());
- if (!StringUtils.isBlank(sslConfig.getCiphers())
+ if (StringUtils.isNotBlank(sslConfig.getCiphers())
&& !"any".equalsIgnoreCase(sslConfig.getCiphers())) {
// If use has mentioned "any" let the SSL layer decide on the ciphers
sslContextFactory.setIncludeCipherSuites(SSLUtil.readArray(sslConfig.getCiphers()));
@@ -97,19 +96,19 @@ public class JettyHelper {
sslContextFactory.setKeyStorePath(sslConfig.getKeystore());
- if (!StringUtils.isBlank(sslConfig.getKeystoreType())) {
+ if (StringUtils.isNotBlank(sslConfig.getKeystoreType())) {
sslContextFactory.setKeyStoreType(sslConfig.getKeystoreType());
}
- if (!StringUtils.isBlank(sslConfig.getKeystorePassword())) {
+ if (StringUtils.isNotBlank(sslConfig.getKeystorePassword())) {
sslContextFactory.setKeyStorePassword(sslConfig.getKeystorePassword());
}
- if (!StringUtils.isBlank(sslConfig.getTruststore())) {
+ if (StringUtils.isNotBlank(sslConfig.getTruststore())) {
sslContextFactory.setTrustStorePath(sslConfig.getTruststore());
}
- if (!StringUtils.isBlank(sslConfig.getTruststorePassword())) {
+ if (StringUtils.isNotBlank(sslConfig.getTruststorePassword())) {
sslContextFactory.setTrustStorePassword(sslConfig.getTruststorePassword());
}
@@ -131,7 +130,7 @@ public class JettyHelper {
jettyServer.setConnectors(new Connector[] {connector});
- if (!StringUtils.isBlank(bindAddress)) {
+ if (StringUtils.isNotBlank(bindAddress)) {
connector.setHost(bindAddress);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index bf0b99c..3e6e4484 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -14,6 +14,32 @@
*/
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.GemFireConfigException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SSLConfigurationFactory;
+import org.apache.geode.internal.net.SocketCreator;
+import org.apache.geode.internal.net.SocketCreatorFactory;
+import org.apache.geode.internal.security.SecurableCommunicationChannel;
+import org.apache.geode.internal.security.SecurityService;
+import org.apache.geode.internal.security.shiro.JMXShiroAuthenticator;
+import org.apache.geode.internal.tcp.TCPConduit;
+import org.apache.geode.management.ManagementException;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.ManagerMXBean;
+import org.apache.geode.management.internal.security.AccessControlMBean;
+import org.apache.geode.management.internal.security.MBeanServerWrapper;
+import org.apache.geode.management.internal.security.ResourceConstants;
+import org.apache.geode.management.internal.unsafe.ReadOpFileAccessController;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
import java.io.IOException;
import java.io.Serializable;
import java.lang.management.ManagementFactory;
@@ -29,7 +55,6 @@ import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Set;
-
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
@@ -43,33 +68,6 @@ import javax.management.remote.rmi.RMIJRMPServerImpl;
import javax.management.remote.rmi.RMIServerImpl;
import javax.rmi.ssl.SslRMIClientSocketFactory;
-import org.apache.logging.log4j.Logger;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
-import org.apache.geode.GemFireConfigException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.internal.GemFireVersion;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.net.SSLConfigurationFactory;
-import org.apache.geode.internal.net.SocketCreator;
-import org.apache.geode.internal.net.SocketCreatorFactory;
-import org.apache.geode.internal.security.SecurableCommunicationChannel;
-import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.internal.security.shiro.JMXShiroAuthenticator;
-import org.apache.geode.internal.tcp.TCPConduit;
-import org.apache.geode.management.ManagementException;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.ManagerMXBean;
-import org.apache.geode.management.internal.security.AccessControlMBean;
-import org.apache.geode.management.internal.security.MBeanServerWrapper;
-import org.apache.geode.management.internal.security.ResourceConstants;
-import org.apache.geode.management.internal.unsafe.ReadOpFileAccessController;
-
/**
* Agent implementation that controls the JMX server end points for JMX clients to connect, such as
* an RMI server.
@@ -317,9 +315,9 @@ public class ManagementAgent {
}
private String getHost(final String bindAddress) throws UnknownHostException {
- if (!StringUtils.isBlank(this.config.getJmxManagerHostnameForClients())) {
+ if (StringUtils.isNotBlank(this.config.getJmxManagerHostnameForClients())) {
return this.config.getJmxManagerHostnameForClients();
- } else if (!StringUtils.isBlank(bindAddress)) {
+ } else if (StringUtils.isNotBlank(bindAddress)) {
return InetAddress.getByName(bindAddress).getHostAddress();
} else {
return SocketCreator.getLocalHost().getHostAddress();
@@ -376,7 +374,7 @@ public class ManagementAgent {
}
String jmxManagerHostnameForClients = this.config.getJmxManagerHostnameForClients();
- if (!StringUtils.isBlank(jmxManagerHostnameForClients)) {
+ if (StringUtils.isNotBlank(jmxManagerHostnameForClients)) {
System.setProperty("java.rmi.server.hostname", jmxManagerHostnameForClients);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
index 837e815..7c9256d 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/RestAgent.java
@@ -14,13 +14,7 @@
*/
package org.apache.geode.management.internal;
-import java.net.UnknownHostException;
-
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.Logger;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -29,12 +23,17 @@ import org.apache.geode.cache.Scope;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.internal.GemFireVersion;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.net.SSLConfigurationFactory;
-import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.cache.InternalRegionArguments;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.net.SSLConfigurationFactory;
+import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.security.SecurableCommunicationChannel;
import org.apache.geode.management.ManagementService;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
+import java.net.UnknownHostException;
/**
* Agent implementation that controls the HTTP server end points used for REST clients to connect
@@ -156,15 +155,15 @@ public class RestAgent {
public static String getBindAddressForHttpService(DistributionConfig config) {
String bindAddress = config.getHttpServiceBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
bindAddress = config.getServerBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
bindAddress = config.getBindAddress();
- if (!StringUtils.isBlank(bindAddress))
+ if (StringUtils.isNotBlank(bindAddress))
return bindAddress;
try {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
index 1b39b73..820e8a5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/SSLUtil.java
@@ -14,15 +14,14 @@
*/
package org.apache.geode.management.internal;
+import org.apache.commons.lang.StringUtils;
+
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.net.ssl.SSLContext;
-import org.apache.geode.internal.lang.StringUtils;
-
/**
*
* @since GemFire 8.1
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
index ef643ac..770695a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
@@ -14,34 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.admin.internal.BackupDataStoreHelper;
import org.apache.geode.admin.internal.BackupDataStoreResult;
import org.apache.geode.cache.persistence.PersistentID;
@@ -89,6 +62,32 @@ import org.apache.geode.management.internal.beans.stats.GatewaySenderClusterStat
import org.apache.geode.management.internal.beans.stats.MemberClusterStatsMonitor;
import org.apache.geode.management.internal.beans.stats.ServerClusterStatsMonitor;
import org.apache.geode.management.internal.cli.json.TypedJson;
+import org.apache.logging.log4j.Logger;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
/**
* This is the gateway to distributed system as a whole. Aggregated metrics and stats are shown
@@ -134,12 +133,12 @@ public class DistributedSystemBridge {
private volatile int serverSetSize;
/**
- * Gatway Sender Proxy set size
+ * Gateway Sender Proxy set size
*/
private volatile int gatewaySenderSetSize;
/**
- * Gatway Receiver Proxy set size
+ * Gateway Receiver Proxy set size
*/
private volatile int gatewayReceiverSetSize;
@@ -238,12 +237,12 @@ public class DistributedSystemBridge {
* @param service Management service
*/
public DistributedSystemBridge(SystemManagementService service) {
- this.distrLockServiceMap = new ConcurrentHashMap<ObjectName, DistributedLockServiceBridge>();
- this.distrRegionMap = new ConcurrentHashMap<ObjectName, DistributedRegionBridge>();
- this.mapOfMembers = new ConcurrentHashMap<ObjectName, MemberMXBean>();
- this.mapOfServers = new ConcurrentHashMap<ObjectName, CacheServerMXBean>();
- this.mapOfGatewayReceivers = new ConcurrentHashMap<ObjectName, GatewayReceiverMXBean>();
- this.mapOfGatewaySenders = new ConcurrentHashMap<ObjectName, GatewaySenderMXBean>();
+ this.distrLockServiceMap = new ConcurrentHashMap<>();
+ this.distrRegionMap = new ConcurrentHashMap<>();
+ this.mapOfMembers = new ConcurrentHashMap<>();
+ this.mapOfServers = new ConcurrentHashMap<>();
+ this.mapOfGatewayReceivers = new ConcurrentHashMap<>();
+ this.mapOfGatewaySenders = new ConcurrentHashMap<>();
this.service = service;
this.cache = GemFireCacheImpl.getInstance();
this.system = cache.getInternalDistributedSystem();
@@ -506,7 +505,7 @@ public class DistributedSystemBridge {
Iterator<DistributedMember> it = result.getSuccessfulMembers().keySet().iterator();
- Map<String, String[]> backedUpDiskStores = new HashMap<String, String[]>();
+ Map<String, String[]> backedUpDiskStores = new HashMap<>();
while (it.hasNext()) {
DistributedMember member = it.next();
Set<PersistentID> setOfDisk = result.getSuccessfulMembers().get(member);
@@ -573,7 +572,7 @@ public class DistributedSystemBridge {
Iterator<GatewayReceiverMXBean> gatewayReceiverIterator =
mapOfGatewayReceivers.values().iterator();
if (gatewayReceiverIterator != null) {
- List<String> listOfReceivers = new ArrayList<String>();
+ List<String> listOfReceivers = new ArrayList<>();
while (gatewayReceiverIterator.hasNext()) {
listOfReceivers.add(gatewayReceiverIterator.next().getBindAddress());
}
@@ -606,7 +605,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- List<String> listOfServer = new ArrayList<String>();
+ List<String> listOfServer = new ArrayList<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
if (bean.isCacheServer()) {
@@ -626,7 +625,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- List<String> listOfServer = new ArrayList<String>();
+ List<String> listOfServer = new ArrayList<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
if (bean.isServer()) {
@@ -657,10 +656,10 @@ public class DistributedSystemBridge {
/**
* @return a list of Gateway Senders
*/
- public String[] listGatwaySenders() {
+ public String[] listGatewaySenders() {
Iterator<GatewaySenderMXBean> gatewaySenderIterator = mapOfGatewaySenders.values().iterator();
if (gatewaySenderIterator != null) {
- List<String> listOfSenders = new ArrayList<String>();
+ List<String> listOfSenders = new ArrayList<>();
while (gatewaySenderIterator.hasNext()) {
listOfSenders.add(gatewaySenderIterator.next().getSenderId());
}
@@ -709,18 +708,15 @@ public class DistributedSystemBridge {
public String[] listLocators() {
if (cache != null) {
// each locator is a string of the form host[port] or bind-addr[port]
- Set<String> set = new HashSet<String>();
+ Set<String> set = new HashSet<>();
Map<InternalDistributedMember, Collection<String>> map =
cache.getDistributionManager().getAllHostedLocators();
for (Collection<String> hostedLocators : map.values()) {
- for (String locator : hostedLocators) {
- set.add(locator);
- }
+ set.addAll(hostedLocators);
}
- String[] locators = set.toArray(new String[set.size()]);
- return locators;
+ return set.toArray(new String[set.size()]);
}
return ManagementConstants.NO_DATA_STRING;
}
@@ -755,7 +751,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- Map<String, String[]> mapOfDisks = new HashMap<String, String[]>();
+ Map<String, String[]> mapOfDisks = new HashMap<>();
while (memberIterator.hasNext()) {
MemberMXBean bean = memberIterator.next();
mapOfDisks.put(bean.getMember(), bean.getDiskStores());
@@ -803,7 +799,7 @@ public class DistributedSystemBridge {
Iterator<MemberMXBean> memberIterator = mapOfMembers.values().iterator();
if (memberIterator != null) {
- Set<String> locatorMemberSet = new TreeSet<String>();
+ Set<String> locatorMemberSet = new TreeSet<>();
while (memberIterator.hasNext()) {
MemberMXBean memberMxBean = memberIterator.next();
if (memberMxBean.isLocator()) {
@@ -822,17 +818,17 @@ public class DistributedSystemBridge {
private String[] listStandAloneLocatorMembers() {
String[] locatorMembers = ManagementConstants.NO_DATA_STRING;
- Set<DistributedMember> members = new HashSet<DistributedMember>();
+ Set<DistributedMember> members = new HashSet<>();
members.add(system.getDistributedMember());
members.addAll(system.getAllOtherMembers());
if (!members.isEmpty()) {
- Set<String> locatorMemberSet = new TreeSet<String>();
+ Set<String> locatorMemberSet = new TreeSet<>();
for (DistributedMember member : members) {
if (DistributionManager.LOCATOR_DM_TYPE == ((InternalDistributedMember) member)
.getVmKind()) {
String name = member.getName();
- name = name != null && !name.trim().isEmpty() ? name : member.getId();
+ name = StringUtils.isNotBlank(name) ? name : member.getId();
locatorMemberSet.add(name);
}
}
@@ -852,7 +848,7 @@ public class DistributedSystemBridge {
Collection<MemberMXBean> values = mapOfMembers.values();
if (values != null) {
- Set<String> groupSet = new TreeSet<String>();
+ Set<String> groupSet = new TreeSet<>();
for (MemberMXBean memberMXBean : values) {
String[] memberGroups = memberMXBean.getGroups();
if (memberGroups != null && memberGroups.length != 0) {
@@ -878,7 +874,7 @@ public class DistributedSystemBridge {
/**
* @param member name or id of the member
- * @return basic Opertaing metrics for a given member.
+ * @return basic Operating metrics for a given member.
*/
public OSMetrics showOSMetrics(String member) throws Exception {
MemberMXBean bean = validateMember(member);
@@ -911,7 +907,7 @@ public class DistributedSystemBridge {
return ManagementConstants.NO_DATA_STRING;
}
// Sort region paths
- SortedSet<String> regionPathsSet = new TreeSet<String>();
+ SortedSet<String> regionPathsSet = new TreeSet<>();
for (DistributedRegionBridge bridge : distrRegionMap.values()) {
regionPathsSet.add(bridge.getFullPath());
}
@@ -933,9 +929,8 @@ public class DistributedSystemBridge {
Set<InternalDistributedMember> members = ShutdownAllRequest.send(dm, 0);
String[] shutDownMembers = new String[members.size()];
int j = 0;
- Iterator<InternalDistributedMember> it = members.iterator();
- while (it.hasNext()) {
- shutDownMembers[j] = it.next().getId();
+ for (InternalDistributedMember member : members) {
+ shutDownMembers[j] = member.getId();
j++;
}
return shutDownMembers;
@@ -949,16 +944,16 @@ public class DistributedSystemBridge {
* replicated region member are up and running so that the recovered data from the disk will be in
* sync;
*
- * @return Array of PeristentMemberDetails (which contains host, directory and disk store id)
+ * @return Array of PersistentMemberDetails (which contains host, directory and disk store id)
*/
public PersistentMemberDetails[] listMissingDiskStores() {
PersistentMemberDetails[] missingDiskStores = null;
- Set<PersistentID> persitentMemberSet = MissingPersistentIDsRequest.send(dm);
- if (persitentMemberSet != null && persitentMemberSet.size() > 0) {
- missingDiskStores = new PersistentMemberDetails[persitentMemberSet.size()];
+ Set<PersistentID> persistentMemberSet = MissingPersistentIDsRequest.send(dm);
+ if (persistentMemberSet != null && persistentMemberSet.size() > 0) {
+ missingDiskStores = new PersistentMemberDetails[persistentMemberSet.size()];
int j = 0;
- for (PersistentID id : persitentMemberSet) {
+ for (PersistentID id : persistentMemberSet) {
missingDiskStores[j] = new PersistentMemberDetails(id.getHost().getCanonicalHostName(),
id.getDirectory(), id.getUUID().toString());
j++;
@@ -974,7 +969,7 @@ public class DistributedSystemBridge {
* @param diskStoreId UUID of the disk store to revoke
* @return successful or failure
*/
- public boolean revokeMissingDiskStores(final String diskStoreId) throws Exception {
+ public boolean revokeMissingDiskStores(final String diskStoreId) {
// make sure that the disk store we're revoking is actually missing
boolean found = false;
PersistentMemberDetails[] details = listMissingDiskStores();
@@ -1018,8 +1013,7 @@ public class DistributedSystemBridge {
public ObjectName fetchMemberObjectName(String member) throws Exception {
validateMember(member);
- ObjectName memberName = MBeanJMXAdapter.getMemberMBeanName(member);
- return memberName;
+ return MBeanJMXAdapter.getMemberMBeanName(member);
}
public ObjectName[] listMemberObjectNames() {
@@ -1062,7 +1056,7 @@ public class DistributedSystemBridge {
}
public ObjectName[] fetchRegionObjectNames(ObjectName memberMBeanName) throws Exception {
- List<ObjectName> list = new ArrayList<ObjectName>();
+ List<ObjectName> list = new ArrayList<>();
if (mapOfMembers.get(memberMBeanName) != null) {
MemberMXBean bean = mapOfMembers.get(memberMBeanName);
String member =
@@ -1080,11 +1074,8 @@ public class DistributedSystemBridge {
}
public ObjectName[] listDistributedRegionObjectNames() {
- List<ObjectName> list = new ArrayList<ObjectName>();
- Iterator<ObjectName> it = distrRegionMap.keySet().iterator();
- while (it.hasNext()) {
- list.add(it.next());
- }
+ List<ObjectName> list = new ArrayList<>();
+ list.addAll(distrRegionMap.keySet());
ObjectName[] objNames = new ObjectName[list.size()];
return list.toArray(objNames);
}
@@ -1127,8 +1118,7 @@ public class DistributedSystemBridge {
public ObjectName fetchDistributedLockServiceObjectName(String lockServiceName) throws Exception {
DistributedLockServiceMXBean bean = service.getDistributedLockServiceMXBean(lockServiceName);
if (bean != null) {
- ObjectName lockSerName = service.getDistributedLockServiceMBeanName(lockServiceName);
- return lockSerName;
+ return service.getDistributedLockServiceMBeanName(lockServiceName);
} else {
throw new Exception(
ManagementStrings.DISTRIBUTED_LOCK_SERVICE_MBEAN_NOT_FOUND_IN_SYSTEM.toString());
@@ -1217,7 +1207,7 @@ public class DistributedSystemBridge {
Set<ObjectName> mbeanSet = service.queryMBeanNames(distributedMember);
if (mbeanSet != null && mbeanSet.size() > 0) {
- listName = new ArrayList<ObjectName>();
+ listName = new ArrayList<>();
for (ObjectName name : mbeanSet) {
if (pattern.apply(name)) {
listName.add(name);
@@ -1226,8 +1216,8 @@ public class DistributedSystemBridge {
}
if (listName != null && listName.size() > 0) {
- ObjectName[] arry = new ObjectName[listName.size()];
- return listName.toArray(arry);
+ ObjectName[] array = new ObjectName[listName.size()];
+ return listName.toArray(array);
}
return ManagementConstants.NO_DATA_OBJECTNAME;
}
@@ -1240,21 +1230,18 @@ public class DistributedSystemBridge {
*/
public int getNumClients() {
if (mapOfServers.keySet().size() > 0) {
- Set<String> uniqueClientSet = new HashSet<String>();
- Iterator<CacheServerMXBean> it = mapOfServers.values().iterator();
- while (it.hasNext()) {
- String[] clients = null;
+ Set<String> uniqueClientSet = new HashSet<>();
+ for (CacheServerMXBean cacheServerMXBean : mapOfServers.values()) {
+ String[] clients;
try {
- clients = it.next().getClientIds();
+ clients = cacheServerMXBean.getClientIds();
} catch (Exception e) {
// Mostly due to condition where member is departed and proxy is still
// with Manager.
clients = null;
}
if (clients != null) {
- for (String client : clients) {
- uniqueClientSet.add(client);
- }
+ Collections.addAll(uniqueClientSet, clients);
}
}
return uniqueClientSet.size();
@@ -1477,10 +1464,8 @@ public class DistributedSystemBridge {
public Map<String, Boolean> viewRemoteClusterStatus() {
if (mapOfGatewaySenders.values().size() > 0) {
- Map<String, Boolean> senderMap = new HashMap<String, Boolean>();
- Iterator<GatewaySenderMXBean> it = mapOfGatewaySenders.values().iterator();
- while (it.hasNext()) {
- GatewaySenderMXBean bean = it.next();
+ Map<String, Boolean> senderMap = new HashMap<>();
+ for (GatewaySenderMXBean bean : mapOfGatewaySenders.values()) {
Integer dsId = bean.getRemoteDSId();
if (dsId != null) {
senderMap.merge(dsId.toString(), bean.isRunning(), Boolean::logicalAnd);
@@ -1548,10 +1533,10 @@ public class DistributedSystemBridge {
synchronized (distrRegionMap) {
DistributedRegionBridge bridge = distrRegionMap.get(distributedRegionObjectName);
if (bridge != null) {
- FederationComponent newObj = (FederationComponent) (fedComp);
+ FederationComponent newObj = fedComp;
bridge.addProxyToMap(proxyName, regionProxy, newObj);
} else {
- FederationComponent newObj = (FederationComponent) (fedComp);
+ FederationComponent newObj = fedComp;
bridge = new DistributedRegionBridge(proxyName, regionProxy, newObj);
DistributedRegionMXBean mbean = new DistributedRegionMBean(bridge);
@@ -1591,10 +1576,10 @@ public class DistributedSystemBridge {
DistributedRegionBridge bridge = distrRegionMap.get(distributedRegionObjectName);
if (bridge != null) {
- FederationComponent newProxy = (FederationComponent) (newValue);
+ FederationComponent newProxy = newValue;
FederationComponent oldProxy = null;
if (oldValue != null) {
- oldProxy = (FederationComponent) oldValue;
+ oldProxy = oldValue;
}
bridge.updateRegion(newProxy, oldProxy);
}
@@ -1651,7 +1636,7 @@ public class DistributedSystemBridge {
FederationComponent newValue) {
// No body is calling this method right now.
// If aggregate stats are added in Distributed Lock Service it will be
- // neeeded.
+ // needed.
}
public void memberDeparted(InternalDistributedMember id, boolean crashed) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
index a87b366..c45da73 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemMBean.java
@@ -14,11 +14,6 @@
*/
package org.apache.geode.management.internal.beans;
-import java.util.Map;
-
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ObjectName;
-
import org.apache.geode.management.DiskBackupStatus;
import org.apache.geode.management.DiskMetrics;
import org.apache.geode.management.DistributedSystemMXBean;
@@ -28,6 +23,10 @@ import org.apache.geode.management.NetworkMetrics;
import org.apache.geode.management.OSMetrics;
import org.apache.geode.management.PersistentMemberDetails;
+import java.util.Map;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectName;
+
/**
* Distributed System MBean
*
@@ -103,7 +102,7 @@ public class DistributedSystemMBean extends NotificationBroadcasterSupport
@Override
public String[] listGatewaySenders() {
- return bridge.listGatwaySenders();
+ return bridge.listGatewaySenders();
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
index 7dce602..003a8f3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/ManagementAdapter.java
@@ -14,26 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.internal.cache.CacheService;
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.DiskStore;
import org.apache.geode.cache.Region;
@@ -42,11 +23,13 @@ import org.apache.geode.cache.server.CacheServer;
import org.apache.geode.cache.wan.GatewayReceiver;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.distributed.Locator;
+import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.ClassLoadUtil;
+import org.apache.geode.internal.cache.CacheService;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.PartitionedRegionHelper;
@@ -75,6 +58,21 @@ import org.apache.geode.management.membership.ClientMembershipEvent;
import org.apache.geode.management.membership.ClientMembershipListener;
import org.apache.geode.management.membership.ClientMembershipListenerAdapter;
import org.apache.geode.pdx.internal.PeerTypeRegistration;
+import org.apache.logging.log4j.Logger;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
/**
* Acts as an intermediate between MBean layer and Federation Layer. Handles all Call backs from
@@ -111,9 +109,9 @@ public class ManagementAdapter {
private MBeanAggregator aggregator;
- public static final List<Class> refreshOnInit = new ArrayList<Class>();
+ public static final List<Class> refreshOnInit = new ArrayList<>();
- public static final List<String> internalLocks = new ArrayList<String>();
+ public static final List<String> internalLocks = new ArrayList<>();
static {
refreshOnInit.add(RegionMXBean.class);
@@ -219,9 +217,7 @@ public class ManagementAdapter {
service.afterCreateProxy(memberObjectName, MemberMXBean.class, localMember, addedComp);
- Iterator<ObjectName> it = registeredMBeans.keySet().iterator();
- while (it.hasNext()) {
- ObjectName objectName = it.next();
+ for (ObjectName objectName : registeredMBeans.keySet()) {
if (objectName.equals(memberObjectName)) {
continue;
}
@@ -235,8 +231,8 @@ public class ManagementAdapter {
FederationComponent newObj = service.getLocalManager().getFedComponents().get(objectName);
- for (int i = 0; i < intfTyps.length; i++) {
- Class intfTyp = (Class) intfTyps[i];
+ for (Type intfTyp1 : intfTyps) {
+ Class intfTyp = (Class) intfTyp1;
service.afterCreateProxy(objectName, intfTyp, object, newObj);
}
@@ -265,12 +261,10 @@ public class ManagementAdapter {
MBeanJMXAdapter jmxAdapter = service.getJMXAdapter();
Map<ObjectName, Object> registeredMBeans = jmxAdapter.getLocalGemFireMBean();
- ObjectName aggregatemMBeanPattern = null;
+ ObjectName aggregatemMBeanPattern;
try {
aggregatemMBeanPattern = new ObjectName(ManagementConstants.AGGREGATE_MBEAN_PATTERN);
- } catch (MalformedObjectNameException e1) {
- throw new ManagementException(e1);
- } catch (NullPointerException e1) {
+ } catch (MalformedObjectNameException | NullPointerException e1) {
throw new ManagementException(e1);
}
@@ -284,10 +278,7 @@ public class ManagementAdapter {
service.afterRemoveProxy(memberObjectName, MemberMXBean.class, localMember, removedComp);
- Iterator<ObjectName> it = registeredMBeans.keySet().iterator();
-
- while (it.hasNext()) {
- ObjectName objectName = it.next();
+ for (ObjectName objectName : registeredMBeans.keySet()) {
if (objectName.equals(memberObjectName)) {
continue;
}
@@ -304,14 +295,11 @@ public class ManagementAdapter {
FederationComponent oldObj = service.getLocalManager().getFedComponents().get(objectName);
- for (int i = 0; i < intfTyps.length; i++) {
- Class intfTyp = (Class) intfTyps[i];
+ for (Type intfTyp1 : intfTyps) {
+ Class intfTyp = (Class) intfTyp1;
service.afterRemoveProxy(objectName, intfTyp, object, oldObj);
}
- } catch (InstanceNotFoundException e) {
- logger.warn("Failed to invoke aggregator for {} with exception {}", objectName,
- e.getMessage(), e);
- } catch (ClassNotFoundException e) {
+ } catch (InstanceNotFoundException | ClassNotFoundException e) {
logger.warn("Failed to invoke aggregator for {} with exception {}", objectName,
e.getMessage(), e);
}
@@ -359,7 +347,7 @@ public class ManagementAdapter {
// Bridge is responsible for extracting data from GemFire Layer
RegionMBeanBridge<K, V> bridge = RegionMBeanBridge.getInstance(region);
- RegionMXBean regionMBean = new RegionMBean<K, V>(bridge);
+ RegionMXBean regionMBean = new RegionMBean<>(bridge);
ObjectName regionMBeanName = MBeanJMXAdapter.getRegionMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), region.getFullPath());
ObjectName changedMBeanName = service.registerInternalMBean(regionMBean, regionMBeanName);
@@ -567,7 +555,7 @@ public class ManagementAdapter {
ObjectName asycnEventQueueMBeanName = MBeanJMXAdapter.getAsycnEventQueueMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), queue.getId());
- AsyncEventQueueMBean bean = null;
+ AsyncEventQueueMBean bean;
try {
bean = (AsyncEventQueueMBean) service.getLocalAsyncEventQueueMXBean(queue.getId());
if (bean == null) {
@@ -616,7 +604,7 @@ public class ManagementAdapter {
}
private Map<String, String> prepareUserData(AlertDetails details) {
- Map<String, String> userData = new HashMap<String, String>();
+ Map<String, String> userData = new HashMap<>();
userData.put(JMXNotificationUserData.ALERT_LEVEL,
AlertDetails.getAlertLevelAsString(details.getAlertLevel()));
@@ -627,7 +615,7 @@ public class ManagementAdapter {
String nameOrId = memberSource; // TODO: what if sender is null?
if (sender != null) {
nameOrId = sender.getName();
- nameOrId = nameOrId != null && !nameOrId.trim().isEmpty() ? nameOrId : sender.getId();
+ nameOrId = StringUtils.isNotBlank(nameOrId) ? nameOrId : sender.getId();
}
userData.put(JMXNotificationUserData.MEMBER, nameOrId);
@@ -799,7 +787,7 @@ public class ManagementAdapter {
synchronized (regionOpLock) {
ObjectName regionMBeanName = MBeanJMXAdapter.getRegionMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), region.getFullPath());
- RegionMBean bean = null;
+ RegionMBean bean;
try {
bean = (RegionMBean) service.getLocalRegionMBean(region.getFullPath());
} catch (ManagementException e) {
@@ -838,7 +826,7 @@ public class ManagementAdapter {
ObjectName diskStoreMBeanName = MBeanJMXAdapter.getDiskStoreMBeanName(
internalCache.getDistributedSystem().getDistributedMember(), disk.getName());
- DiskStoreMBean bean = null;
+ DiskStoreMBean bean;
try {
bean = (DiskStoreMBean) service.getLocalDiskStoreMBean(disk.getName());
if (bean == null) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
index f701d29..9829df3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/QueryDataFunction.java
@@ -14,21 +14,7 @@
*/
package org.apache.geode.management.internal.beans;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.logging.log4j.Logger;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.DataPolicy;
@@ -64,6 +50,19 @@ import org.apache.geode.management.internal.cli.commands.DataCommands;
import org.apache.geode.management.internal.cli.json.GfJsonException;
import org.apache.geode.management.internal.cli.json.GfJsonObject;
import org.apache.geode.management.internal.cli.json.TypedJson;
+import org.apache.logging.log4j.Logger;
+
+import java.io.Serializable;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* This function is executed on one or multiple members based on the member input to
@@ -128,7 +127,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
final boolean showMember, final String regionName, final int limit,
final int queryResultSetLimit, final int queryCollectionsDepth) throws Exception {
InternalCache cache = getCache();
- Function loclQueryFunc = new LocalQueryFunction("LocalQueryFunction", regionName, showMember)
+ Function localQueryFunc = new LocalQueryFunction("LocalQueryFunction", regionName, showMember)
.setOptimizeForWrite(true);
queryString = applyLimitClause(queryString, limit, queryResultSetLimit);
@@ -154,7 +153,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
results = query.execute();
} else {
- ResultCollector rcollector = null;
+ ResultCollector rcollector;
PartitionedRegion parRegion =
PartitionedRegionHelper.getPartitionedRegion(regionName, cache);
@@ -169,13 +168,11 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
LocalDataSet lds = new LocalDataSet(parRegion, localPrimaryBucketSet);
DefaultQuery query = (DefaultQuery) cache.getQueryService().newQuery(queryString);
- SelectResults selectResults =
- (SelectResults) lds.executeQuery(query, null, localPrimaryBucketSet);
- results = selectResults;
+ results = (SelectResults) lds.executeQuery(query, null, localPrimaryBucketSet);
}
} else {
rcollector = FunctionService.onRegion(cache.getRegion(regionName))
- .setArguments(queryString).execute(loclQueryFunc);
+ .setArguments(queryString).execute(localQueryFunc);
results = rcollector.getResult();
}
}
@@ -183,8 +180,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (results != null && results instanceof SelectResults) {
SelectResults selectResults = (SelectResults) results;
- for (Iterator iter = selectResults.iterator(); iter.hasNext();) {
- Object object = iter.next();
+ for (Object object : selectResults) {
result.add(RESULT_KEY, object);
noDataFound = false;
}
@@ -203,7 +199,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (noDataFound) {
return new QueryDataFunctionResult(QUERY_EXEC_SUCCESS,
- BeanUtilFuncs.compress(new JsonisedErroMessage(NO_DATA_FOUND).toString()));
+ BeanUtilFuncs.compress(new JsonisedErrorMessage(NO_DATA_FOUND).toString()));
}
return new QueryDataFunctionResult(QUERY_EXEC_SUCCESS,
BeanUtilFuncs.compress(result.toString()));
@@ -272,7 +268,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
// member.
// Note , if no member is selected this is the code path executed. A
// random associated member is chosen.
- List<String> decompressedList = new ArrayList<String>();
+ List<String> decompressedList = new ArrayList<>();
decompressedList.add(BeanUtilFuncs.decompress(result.compressedBytes));
return wrapResult(decompressedList.toString());
}
@@ -290,10 +286,10 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
Iterator<QueryDataFunctionResult> it = list.iterator();
- List<String> decompressedList = new ArrayList<String>();
+ List<String> decompressedList = new ArrayList<>();
while (it.hasNext()) {
- String decompressedStr = null;
+ String decompressedStr;
decompressedStr = BeanUtilFuncs.decompress(it.next().compressedBytes);
decompressedList.add(decompressedStr);
}
@@ -308,12 +304,6 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
} catch (FunctionException fe) {
throw new Exception(
ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(fe.getMessage()));
- } catch (IOException e) {
- throw new Exception(
- ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(e.getMessage()));
- } catch (Exception e) {
- throw new Exception(
- ManagementStrings.QUERY__MSG__QUERY_EXEC.toLocalizedString(e.getMessage()));
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
@@ -339,20 +329,20 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
throws Exception {
if (query == null || query.isEmpty()) {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__QUERY_EMPTY.toLocalizedString())
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__QUERY_EMPTY.toLocalizedString())
.toString();
}
Set<DistributedMember> inputMembers = null;
- if (members != null && !members.trim().isEmpty()) {
- inputMembers = new HashSet<DistributedMember>();
+ if (StringUtils.isNotBlank(members)) {
+ inputMembers = new HashSet<>();
StringTokenizer st = new StringTokenizer(members, ",");
while (st.hasMoreTokens()) {
String member = st.nextToken();
DistributedMember distributedMember = BeanUtilFuncs.getDistributedMemberByNameOrId(member);
inputMembers.add(distributedMember);
if (distributedMember == null) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__INVALID_MEMBER.toLocalizedString(member)).toString();
}
}
@@ -370,7 +360,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
for (String regionPath : regionsInQuery) {
DistributedRegionMXBean regionMBean = service.getDistributedRegionMXBean(regionPath);
if (regionMBean == null) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND.toLocalizedString(regionPath))
.toString();
} else {
@@ -379,7 +369,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (inputMembers != null && inputMembers.size() > 0) {
if (!associatedMembers.containsAll(inputMembers)) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND_ON_MEMBERS
.toLocalizedString(regionPath)).toString();
}
@@ -387,7 +377,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
}
}
} else {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__INVALID_QUERY
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__INVALID_QUERY
.toLocalizedString("Region mentioned in query probably missing /")).toString();
}
@@ -398,7 +388,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
if (regionMBean.getRegionType().equals(DataPolicy.PARTITION.toString())
|| regionMBean.getRegionType().equals(DataPolicy.PERSISTENT_PARTITION.toString())) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__JOIN_OP_EX.toLocalizedString()).toString();
}
}
@@ -422,8 +412,7 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
functionArgs[LIMIT] = limit;
functionArgs[QUERY_RESULTSET_LIMIT] = queryResultSetLimit;
functionArgs[QUERY_COLLECTIONS_DEPTH] = queryCollectionsDepth;
- Object result = callFunction(functionArgs, inputMembers, zipResult);
- return result;
+ return callFunction(functionArgs, inputMembers, zipResult);
} else { // Query on any random member
functionArgs[DISPLAY_MEMBERWISE] = false;
functionArgs[QUERY] = query;
@@ -431,17 +420,16 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
functionArgs[LIMIT] = limit;
functionArgs[QUERY_RESULTSET_LIMIT] = queryResultSetLimit;
functionArgs[QUERY_COLLECTIONS_DEPTH] = queryCollectionsDepth;
- Object result = callFunction(functionArgs, associatedMembers, zipResult);
- return result;
+ return callFunction(functionArgs, associatedMembers, zipResult);
}
} else {
- return new JsonisedErroMessage(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND
+ return new JsonisedErrorMessage(ManagementStrings.QUERY__MSG__REGIONS_NOT_FOUND
.toLocalizedString(regionsInQuery.toString())).toString();
}
} catch (QueryInvalidException qe) {
- return new JsonisedErroMessage(
+ return new JsonisedErrorMessage(
ManagementStrings.QUERY__MSG__INVALID_QUERY.toLocalizedString(qe.getMessage()))
.toString();
}
@@ -451,13 +439,13 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
return (InternalCache) CacheFactory.getAnyInstance();
}
- private static class JsonisedErroMessage {
+ private static class JsonisedErrorMessage {
private static String message = "message";
private GfJsonObject gFJsonObject = new GfJsonObject();
- public JsonisedErroMessage(final String errorMessage) throws Exception {
+ public JsonisedErrorMessage(final String errorMessage) throws Exception {
try {
gFJsonObject.put(message, errorMessage);
} catch (GfJsonException e) {
@@ -483,10 +471,10 @@ public class QueryDataFunction extends FunctionAdapter implements InternalEntity
private static Set<String> compileQuery(final InternalCache cache, final String query)
throws QueryInvalidException {
QCompiler compiler = new QCompiler();
- Set<String> regionsInQuery = null;
+ Set<String> regionsInQuery;
try {
CompiledValue compiledQuery = compiler.compileQuery(query);
- Set<String> regions = new HashSet<String>();
+ Set<String> regions = new HashSet<>();
compiledQuery.getRegionsInQuery(regions, null);
regionsInQuery = Collections.unmodifiableSet(regions);
return regionsInQuery;
[14/28] geode git commit: GEODE-2929: remove superfluous final from
methods
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
index 870e778..44171e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessage.java
@@ -224,8 +224,8 @@ public class DistributedRegionFunctionStreamingMessage extends DistributionMessa
}
}
- protected final boolean operateOnDistributedRegion(final DistributionManager dm,
- DistributedRegion r) throws ForceReattemptException {
+ protected boolean operateOnDistributedRegion(final DistributionManager dm, DistributedRegion r)
+ throws ForceReattemptException {
if (this.functionObject == null) {
ReplyMessage.send(getSender(), this.processorId,
new ReplyException(new FunctionException(
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
index 42bf10f..e236f80 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedRemoveAllOperation.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -21,7 +20,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.Logger;
@@ -41,7 +39,6 @@ import org.apache.geode.internal.ByteArrayDataInput;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList;
-import org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData;
import org.apache.geode.internal.cache.FilterRoutingInfo.FilterInfo;
import org.apache.geode.internal.cache.ha.ThreadIdentifier;
import org.apache.geode.internal.cache.partitioned.PutAllPRMessage;
@@ -59,13 +56,12 @@ import org.apache.geode.internal.offheap.annotations.Unretained;
/**
* Handles distribution of a Region.removeAll operation.
+ *
+ * TODO: extend DistributedCacheOperation instead of AbstractUpdateOperation
*
* @since GemFire 8.1
*/
-public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TODO extend
- // DistributedCacheOperation
- // instead
-{
+public class DistributedRemoveAllOperation extends AbstractUpdateOperation {
private static final Logger logger = LogService.getLogger();
/**
@@ -247,7 +243,7 @@ public class DistributedRemoveAllOperation extends AbstractUpdateOperation // TO
}
}
- public final EntryEventImpl getBaseEvent() {
+ public EntryEventImpl getBaseEvent() {
return getEvent();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
index 1d65579..3048e52 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
@@ -307,7 +307,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
* whenever we try to schedule more expiration tasks.
*/
@Override
- public final void run2() {
+ public void run2() {
try {
if (executor != null) {
executor.execute(new Runnable() {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 4ed583a..c813a80 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -4317,7 +4317,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
}
@Override
- public final InternalResourceManager getInternalResourceManager() {
+ public InternalResourceManager getInternalResourceManager() {
return getInternalResourceManager(true);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
index 8d28a53..f2be3c0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GridAdvisor.java
@@ -271,24 +271,24 @@ public abstract class GridAdvisor extends DistributionAdvisor {
finishInit();
}
- public final void setHost(String host) {
+ public void setHost(String host) {
this.host = host;
}
- public final void setPort(int port) {
+ public void setPort(int port) {
this.port = port;
}
- public final String getHost() {
+ public String getHost() {
return this.host;
}
- public final int getPort() {
+ public int getPort() {
return this.port;
}
@Override
- public final ProfileId getId() {
+ public ProfileId getId() {
if (this.id == null)
throw new IllegalStateException("profile id not yet initialized");
return this.id;
@@ -300,7 +300,7 @@ public abstract class GridAdvisor extends DistributionAdvisor {
*
* @since GemFire 5.7
*/
- protected final void tellLocalControllers(boolean removeProfile, boolean exchangeProfiles,
+ protected void tellLocalControllers(boolean removeProfile, boolean exchangeProfiles,
final List<Profile> replyProfiles) {
final List<Locator> locators = Locator.getLocators();
for (int i = 0; i < locators.size(); i++) {
@@ -325,7 +325,7 @@ public abstract class GridAdvisor extends DistributionAdvisor {
*
* @since GemFire 5.7
*/
- protected final void tellLocalBridgeServers(boolean removeProfile, boolean exchangeProfiles,
+ protected void tellLocalBridgeServers(boolean removeProfile, boolean exchangeProfiles,
final List<Profile> replyProfiles) {
final InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
index fb5f0cf..82df980 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InitialImageOperation.java
@@ -1515,7 +1515,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return this.targetReinitialized ? DistributionManager.WAITING_POOL_EXECUTOR
: DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
@@ -2160,7 +2160,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
@@ -2431,7 +2431,7 @@ public class InitialImageOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return this.targetReinitialized ? DistributionManager.WAITING_POOL_EXECUTOR
: DistributionManager.HIGH_PRIORITY_EXECUTOR;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
index 3a0bf8e..617001f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessage.java
@@ -375,7 +375,7 @@ public class MemberFunctionStreamingMessage extends DistributionMessage
return this.txUniqId;
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
} else {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
index 805b900..a6bb959 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/NonLocalRegionEntry.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- *
- */
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -40,6 +37,7 @@ import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
+
private long lastModified;
private boolean isRemoved;
private Object key;
@@ -291,7 +289,7 @@ public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
.toLocalizedString());
}
- public final Object getValueInVM(RegionEntryContext context) {
+ public Object getValueInVM(RegionEntryContext context) {
return this.value;
}
@@ -360,7 +358,7 @@ public class NonLocalRegionEntry implements RegionEntry, VersionStamp {
return false;
}
- public final Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
+ public Object getValueInVMOrDiskWithoutFaultIn(LocalRegion owner) {
return this.value;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index b171a95..037bff6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -252,16 +252,6 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
return numPrimaries.get();
}
-
- /**
- * Indicates if this data store is managing buckets
- *
- * @return true if it is managing buckets
- */
- final boolean isManagingAnyBucket() {
- return !this.localBucket2RegionMap.isEmpty();
- }
-
/**
* Try to grab buckets for all the colocated regions /* In case we can't grab buckets there is no
* going back
@@ -872,55 +862,20 @@ public class PartitionedRegionDataStore implements HasCachePerfStats {
event.getRegion().getFullPath(), event.getKey(), event.getDistributedMember());
}
- public final void afterRegionInvalidate(RegionEvent event) {}
+ public void afterRegionInvalidate(RegionEvent event) {}
- public final void afterRegionDestroy(RegionEvent event) {}
+ public void afterRegionDestroy(RegionEvent event) {}
- public final void afterRegionClear(RegionEvent event) {}
+ public void afterRegionClear(RegionEvent event) {}
- public final void afterRegionCreate(RegionEvent event) {}
+ public void afterRegionCreate(RegionEvent event) {}
- public final void afterRegionLive(RegionEvent event) {}
+ public void afterRegionLive(RegionEvent event) {}
- public final void close() {}
+ public void close() {}
};
}
- // private void addBucketMapping(Integer bucketId, Node theNode)
- // {
- // VersionedArrayList list = (VersionedArrayList)this.partitionedRegion
- // .getBucket2Node().get(bucketId);
- // // Create a new list to avoid concurrent modification exceptions when
- // // the array list is serialized e.g. GII
- // if (list == null) {
- // list = new VersionedArrayList(
- // this.partitionedRegion.getRedundantCopies() + 1);
- // list.add(theNode);
- //
- // }
- // else {
- // for(Iterator itr =list.iterator(); itr.hasNext();) {
- // Node nd = (Node)itr.next();
- // if( !PartitionedRegionHelper.isMemberAlive(nd.getMemberId(),
- // this.partitionedRegion.cache)
- // && !this.partitionedRegion.isPresentInPRConfig(nd)) {
- // list.remove(nd);
- // if(list.size() ==0 ) {
- // PartitionedRegionHelper.logForDataLoss(this.partitionedRegion,
- // bucketId.intValue(), "addBucketMapping");
- // }
- // }
- //
- // }
- // if (!list.contains(theNode)) {
- // list.add(theNode);
- // }
- // }
- // this.partitionedRegion.checkClosed();
- // this.partitionedRegion.checkReadiness();
- // this.partitionedRegion.getBucket2Node().put(bucketId, list);
- // }
-
public CacheLoader getCacheLoader() {
return this.loader;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
index 097ca41..a06c437 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PlaceHolderDiskRegion.java
@@ -28,10 +28,10 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
* thrown away and a real DiskRegion instance will replace it. This class needs to keep track of any
* information that can be recovered from the DiskInitFile.
*
- *
* @since GemFire prPersistSprint2
*/
public class PlaceHolderDiskRegion extends AbstractDiskRegion implements DiskRecoveryStore {
+
private final String name;
/**
@@ -59,7 +59,7 @@ public class PlaceHolderDiskRegion extends AbstractDiskRegion implements DiskRec
}
@Override
- public final String getName() {
+ public String getName() {
return this.name;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
index cfc9fdd..ab90a05 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ProxyBucketRegion.java
@@ -218,7 +218,7 @@ public class ProxyBucketRegion implements Bucket {
return this.partitionedRegion.getAttributes();
}
- public final BucketAdvisor getBucketAdvisor() {
+ public BucketAdvisor getBucketAdvisor() {
return this.advisor;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
index 913836a..0c141cc 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteFetchEntryMessage.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.io.DataInput;
@@ -94,11 +93,6 @@ public class RemoteFetchEntryMessage extends RemoteOperationMessage {
return p;
}
- // final public int getProcessorType()
- // {
- // return DistributionManager.PARTITIONED_REGION_EXECUTOR;
- // }
-
@Override
public boolean isSevereAlertCompatible() {
// allow forced-disconnect processing for all cache op messages
@@ -106,7 +100,7 @@ public class RemoteFetchEntryMessage extends RemoteOperationMessage {
}
@Override
- protected final boolean operateOnRegion(DistributionManager dm, LocalRegion r, long startTime)
+ protected boolean operateOnRegion(DistributionManager dm, LocalRegion r, long startTime)
throws RemoteOperationException {
// RemoteFetchEntryMessage is used in refreshing client caches during interest list recovery,
// so don't be too verbose or hydra tasks may time out
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
index 0e9f8c5..f029c31 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemotePutAllMessage.java
@@ -55,7 +55,6 @@ import org.apache.geode.internal.cache.tier.sockets.VersionedObjectList;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.offheap.annotations.Released;
@@ -232,7 +231,7 @@ public class RemotePutAllMessage extends RemoteOperationMessageWithDirectReply {
}
@Override
- public final void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
index d4d4c26..4b51705 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteRemoveAllMessage.java
@@ -225,7 +225,7 @@ public class RemoteRemoveAllMessage extends RemoteOperationMessageWithDirectRepl
}
@Override
- public final void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index 3ad1137..e093d95 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
@@ -303,7 +303,7 @@ public class StateFlushOperation {
}
@Override
- final public int getProcessorType() {
+ public int getProcessorType() {
return processorType;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
index 95c2cc2..8acc63b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXEvent.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import org.apache.geode.cache.*;
@@ -20,14 +19,12 @@ import java.util.*;
import org.apache.geode.internal.offheap.Releasable;
/**
- * <p>
* The internal implementation of the {@link TransactionEvent} interface
- *
*
* @since GemFire 4.0
- *
*/
public class TXEvent implements TransactionEvent, Releasable {
+
private final TXStateInterface localTxState;
private List events;
private List createEvents = null;
@@ -147,7 +144,7 @@ public class TXEvent implements TransactionEvent, Releasable {
return true;
}
- public final Cache getCache() {
+ public Cache getCache() {
return this.cache;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
index 32fe284..ffc0758 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXId.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import org.apache.geode.internal.ExternalizableDSFID;
@@ -25,16 +24,15 @@ import org.apache.geode.distributed.internal.membership.*;
/**
* The implementation of the {@link TransactionId} interface stored in the transaction state and
- * used, amoung other things, to uniquely identify a transaction in a confederation of transaction
+ * used, among other things, to uniquely identify a transaction in a confederation of transaction
* participants (currently VM in a Distributed System).
*
- *
* @since GemFire 4.0
- *
* @see TXManagerImpl#begin
* @see org.apache.geode.cache.CacheTransactionManager#getTransactionId
*/
public class TXId extends ExternalizableDSFID implements TransactionId {
+
/** The domain of a transaction, currently the VM's unique identifier */
private InternalDistributedMember memberId;
/** Per unique identifier within the transactions memberId */
@@ -104,7 +102,7 @@ public class TXId extends ExternalizableDSFID implements TransactionId {
this.memberId = DSFIDFactory.readInternalDistributedMember(in);
}
- public static final TXId createFromData(DataInput in) throws IOException, ClassNotFoundException {
+ public static TXId createFromData(DataInput in) throws IOException, ClassNotFoundException {
TXId result = new TXId();
InternalDataSerializer.invokeFromData(result, in);
return result;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
index 24cbaa2..2e991e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXMessage.java
@@ -185,7 +185,7 @@ public abstract class TXMessage extends SerialDistributionMessage
this.txMemberId = DataSerializer.readObject(in);
}
- public final InternalDistributedMember getMemberToMasqueradeAs() {
+ public InternalDistributedMember getMemberToMasqueradeAs() {
if (txMemberId == null) {
return getSender();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
index 6a6e9ad..2c8c28b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
@@ -12,7 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-
package org.apache.geode.internal.cache;
import java.util.ArrayList;
@@ -32,7 +31,6 @@ import javax.transaction.Status;
import org.apache.logging.log4j.Logger;
import org.apache.geode.CancelException;
-import org.apache.geode.InternalGemFireException;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CommitConflictException;
@@ -68,9 +66,7 @@ import org.apache.geode.internal.offheap.annotations.Retained;
* TXState is the entity that tracks the transaction state on a per thread basis, noting changes to
* Region entries on a per operation basis. It lives on the node where transaction data exists.
*
- *
* @since GemFire 4.0
- *
* @see TXManagerImpl
*/
public class TXState implements TXStateInterface {
@@ -1204,16 +1200,6 @@ public class TXState implements TXStateInterface {
return readRegion(localRegion);
}
-
- final TXEntryState txWriteEntry(LocalRegion region, EntryEventImpl event, boolean ifNew,
- boolean requireOldValue) {
- try {
- return txWriteEntry(region, event, ifNew, requireOldValue, null);
- } catch (EntryNotFoundException e) {
- throw new InternalGemFireException("caught unexpected exception", e);
- }
- }
-
/**
* @param requireOldValue if true set the old value in the event, even if ifNew and entry doesn't
* currently exist (this is needed for putIfAbsent).
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
index 5dd624b..6055705 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXStateStub.java
@@ -12,9 +12,6 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/**
- * File comment
- */
package org.apache.geode.internal.cache;
import java.util.Collection;
@@ -46,10 +43,9 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
/**
* TXStateStub lives on the accessor node when we are remoting a transaction. It is a stub for
* {@link TXState}.
- *
- *
*/
public abstract class TXStateStub implements TXStateInterface {
+
protected final DistributedMember target;
protected final TXStateProxy proxy;
protected Runnable internalAfterSendRollback;
@@ -57,11 +53,6 @@ public abstract class TXStateStub implements TXStateInterface {
Map<Region<?, ?>, TXRegionStub> regionStubs = new HashMap<Region<?, ?>, TXRegionStub>();
-
- /**
- * @param stateProxy
- * @param target
- */
protected TXStateStub(TXStateProxy stateProxy, DistributedMember target) {
this.target = target;
this.proxy = stateProxy;
@@ -113,8 +104,6 @@ public abstract class TXStateStub implements TXStateInterface {
}
}
-
-
/**
* Get or create a TXRegionStub for the given region. For regions that are new to the tx, we
* validate their eligibility.
@@ -122,7 +111,7 @@ public abstract class TXStateStub implements TXStateInterface {
* @param region The region to involve in the tx.
* @return existing or new stub for region
*/
- protected final TXRegionStub getTXRegionStub(LocalRegion region) {
+ protected TXRegionStub getTXRegionStub(LocalRegion region) {
TXRegionStub stub = regionStubs.get(region);
if (stub == null) {
/*
@@ -139,7 +128,6 @@ public abstract class TXStateStub implements TXStateInterface {
return this.regionStubs;
}
-
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
index 3c0dd9b..b53d498 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegionEntry {
+
public VMStatsDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegion
}
private static class VMStatsDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsDiskLRURegionEntryHeap extends VMStatsDiskLRURegion
return new VMStatsDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
index d8f5083..c14b15a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VMStatsDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRUReg
}
private static class VMStatsDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VMStatsDiskLRURegionEntryOffHeap extends VMStatsDiskLRUReg
return new VMStatsDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
index c193444..554268a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry {
+
public VMStatsDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry
}
private static class VMStatsDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsDiskRegionEntryHeap extends VMStatsDiskRegionEntry
return new VMStatsDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
index 9ec129f..cfe8fef 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEntry
implements OffHeapRegionEntry {
+
public VMStatsDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEnt
}
private static class VMStatsDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsDiskRegionEntryOffHeap extends VMStatsDiskRegionEnt
return new VMStatsDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
index 16c1013..1d474fa 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
+
public VMStatsLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
}
private static class VMStatsLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMStatsLRURegionEntryHeap extends VMStatsLRURegionEntry {
return new VMStatsLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
index 52d7f6f..95487d0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
implements OffHeapRegionEntry {
+
public VMStatsLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
}
private static class VMStatsLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsLRURegionEntryOffHeap extends VMStatsLRURegionEntry
return new VMStatsLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
index ce3641b..082b645 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
+
public VMStatsRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -28,7 +29,7 @@ public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
}
private static class VMStatsRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -53,7 +54,7 @@ public abstract class VMStatsRegionEntryHeap extends VMStatsRegionEntry {
return new VMStatsRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
index 1689a8f..03fd31d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
implements OffHeapRegionEntry {
+
public VMStatsRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
}
private static class VMStatsRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMStatsRegionEntryOffHeap extends VMStatsRegionEntry
return new VMStatsRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMStatsRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
index 24bd9f4..56d5414 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEntry {
+
public VMThinDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEn
}
private static class VMThinDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinDiskLRURegionEntryHeap extends VMThinDiskLRURegionEn
return new VMThinDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
index 20a4127..c9d2eca 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VMThinDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegio
}
private static class VMThinDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VMThinDiskLRURegionEntryOffHeap extends VMThinDiskLRURegio
return new VMThinDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
index 27b5a5a..6018f50 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
+
public VMThinDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
}
private static class VMThinDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinDiskRegionEntryHeap extends VMThinDiskRegionEntry {
return new VMThinDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
index e900c2c..60c1628 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
implements OffHeapRegionEntry {
+
public VMThinDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
}
private static class VMThinDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMThinDiskRegionEntryOffHeap extends VMThinDiskRegionEntry
return new VMThinDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
index 44ba283..dacba73 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
+
public VMThinLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
}
private static class VMThinLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VMThinLRURegionEntryHeap extends VMThinLRURegionEntry {
return new VMThinLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
index 9ed657d..9e6a611 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
implements OffHeapRegionEntry {
+
public VMThinLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
}
private static class VMThinLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -55,7 +56,7 @@ public abstract class VMThinLRURegionEntryOffHeap extends VMThinLRURegionEntry
return new VMThinLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
index 3666a0a..d995852 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryHeap.java
@@ -29,7 +29,7 @@ public abstract class VMThinRegionEntryHeap extends VMThinRegionEntry {
}
private static class VMThinRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +54,7 @@ public abstract class VMThinRegionEntryHeap extends VMThinRegionEntry {
return new VMThinRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
index 6426df0..64c305e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMThinRegionEntryOffHeap.java
@@ -31,7 +31,7 @@ public abstract class VMThinRegionEntryOffHeap extends VMThinRegionEntry
}
private static class VMThinRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +56,7 @@ public abstract class VMThinRegionEntryOffHeap extends VMThinRegionEntry
return new VMThinRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VMThinRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
index 6c7bc91..1f7b878 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskLRURegionEntryHeap
extends VersionedStatsDiskLRURegionEntry {
+
public VersionedStatsDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsDiskLRURegionEntryHeap
}
private static class VersionedStatsDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsDiskLRURegionEntryHeap
return new VersionedStatsDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
index 8b38a2b..808a0e5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskLRURegionEntryOffHeap
extends VersionedStatsDiskLRURegionEntry implements OffHeapRegionEntry {
+
public VersionedStatsDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -31,7 +32,7 @@ public abstract class VersionedStatsDiskLRURegionEntryOffHeap
private static class VersionedStatsDiskLRURegionEntryOffHeapFactory
implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -58,7 +59,7 @@ public abstract class VersionedStatsDiskLRURegionEntryOffHeap
return new VersionedStatsDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
index c6bdf93..3e440ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDiskRegionEntry {
+
public VersionedStatsDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDi
}
private static class VersionedStatsDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedStatsDiskRegionEntryHeap extends VersionedStatsDi
return new VersionedStatsDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
index d2f1dcf..b5e0395 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStatsDiskRegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStat
}
private static class VersionedStatsDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsDiskRegionEntryOffHeap extends VersionedStat
return new VersionedStatsDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
index 6978d51..c698e63 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRURegionEntry {
+
public VersionedStatsLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRU
}
private static class VersionedStatsLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedStatsLRURegionEntryHeap extends VersionedStatsLRU
return new VersionedStatsLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
index f46bcbf..124d03a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStatsLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStats
}
private static class VersionedStatsLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsLRURegionEntryOffHeap extends VersionedStats
return new VersionedStatsLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
index 55dc5ef..bc33c35 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegionEntry {
+
public VersionedStatsRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegion
}
private static class VersionedStatsRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -54,7 +55,7 @@ public abstract class VersionedStatsRegionEntryHeap extends VersionedStatsRegion
return new VersionedStatsRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
index 2fe12c1..e272a5b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsRegionEntry
implements OffHeapRegionEntry {
+
public VersionedStatsRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsReg
}
private static class VersionedStatsRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedStatsRegionEntryOffHeap extends VersionedStatsReg
return new VersionedStatsRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedStatsRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
index 1eec3e9..af7c5cb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinDiskLRURegionEntry {
+
public VersionedThinDiskLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinD
}
private static class VersionedThinDiskLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinDiskLRURegionEntryHeap extends VersionedThinD
return new VersionedThinDiskLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
index e82a0aa..746ddc4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedThinDiskLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinDiskLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedTh
}
private static class VersionedThinDiskLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinDiskLRURegionEntryOffHeap extends VersionedTh
return new VersionedThinDiskLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskLRURegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
index 42d8564..bfa0428 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDiskRegionEntry {
+
public VersionedThinDiskRegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDisk
}
private static class VersionedThinDiskRegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinDiskRegionEntryHeap extends VersionedThinDisk
return new VersionedThinDiskRegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskRegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
index 4bdb7a4..3d47afe 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinDiskRegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinDiskRegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinDiskRegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinD
}
private static class VersionedThinDiskRegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinDiskRegionEntryOffHeap extends VersionedThinD
return new VersionedThinDiskRegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinDiskRegionEntryOffHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
index fb260be..49e205b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryHeap.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.cache;
import java.util.UUID;
public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURegionEntry {
+
public VersionedThinLRURegionEntryHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -29,7 +30,7 @@ public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURe
}
private static class VersionedThinLRURegionEntryHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -56,7 +57,7 @@ public abstract class VersionedThinLRURegionEntryHeap extends VersionedThinLRURe
return new VersionedThinLRURegionEntryHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinLRURegionEntryHeapObjectKey.class;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
index 1286bb6..0aa2c5f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedThinLRURegionEntryOffHeap.java
@@ -18,6 +18,7 @@ import java.util.UUID;
public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLRURegionEntry
implements OffHeapRegionEntry {
+
public VersionedThinLRURegionEntryOffHeap(RegionEntryContext context, Object value) {
super(context, value);
}
@@ -30,7 +31,7 @@ public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLR
}
private static class VersionedThinLRURegionEntryOffHeapFactory implements RegionEntryFactory {
- public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext context, Object key, Object value) {
if (InlineKeyHelper.INLINE_REGION_KEYS) {
Class<?> keyClass = key.getClass();
if (keyClass == Integer.class) {
@@ -57,7 +58,7 @@ public abstract class VersionedThinLRURegionEntryOffHeap extends VersionedThinLR
return new VersionedThinLRURegionEntryOffHeapObjectKey(context, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
// The class returned from this method is used to estimate the memory size.
// This estimate will not take into account the memory saved by inlining the keys.
return VersionedThinLRURegionEntryOffHeapObjectKey.class;
[06/28] geode git commit: GEODE-1994: Overhaul of
internal.lang.StringUtils to extend and heavily use commons.lang.StringUtils
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
index bd6d810..c63b10b 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
@@ -14,6 +14,30 @@
*/
package org.apache.geode.management.internal.cli;
+import org.apache.commons.lang.StringUtils;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.execute.AbstractExecution;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
@@ -42,30 +66,6 @@ import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.cache.execute.AbstractExecution;
-import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.DistributedSystemMXBean;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResultException;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-
/**
* This class contains utility methods used by classes used to build the Command Line Interface
* (CLI).
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
index ae44e24..26b903b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AbstractCommandsSupport.java
@@ -14,13 +14,7 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.springframework.shell.core.CommandMarker;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.Function;
@@ -29,13 +23,18 @@ import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.Result;
import org.apache.geode.management.internal.cli.i18n.CliStrings;
import org.apache.geode.management.internal.cli.shell.Gfsh;
import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
+import org.springframework.shell.core.CommandMarker;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.HashSet;
+import java.util.Set;
/**
* The AbstractCommandsSupport class is an abstract base class encapsulating common functionality
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
index 5dfc1b8..ca2de76 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
@@ -23,6 +23,7 @@ import org.apache.geode.cache.execute.FunctionInvocationTargetException;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import org.apache.geode.internal.logging.log4j.LogLevel;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.ConverterHint;
import org.apache.geode.management.cli.Result;
@@ -42,7 +43,6 @@ import org.apache.geode.management.internal.cli.result.ErrorResultData;
import org.apache.geode.management.internal.cli.result.InfoResultData;
import org.apache.geode.management.internal.cli.result.ResultBuilder;
import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.internal.logging.log4j.LogLevel;
import org.apache.geode.management.internal.configuration.domain.XmlEntity;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
@@ -56,8 +56,6 @@ import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -76,7 +74,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
new AlterRuntimeConfigFunction();
@CliCommand(value = {CliStrings.DESCRIBE_CONFIG}, help = CliStrings.DESCRIBE_CONFIG__HELP)
- @CliMetaData(shellOnly = false, relatedTopic = {CliStrings.TOPIC_GEODE_CONFIG})
+ @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_CONFIG})
@ResourceOperation(resource = Resource.CLUSTER, operation = Operation.READ)
public Result describeConfig(@CliOption(key = CliStrings.DESCRIBE_CONFIG__MEMBER,
optionContext = ConverterHint.ALL_MEMBER_IDNAME,
@@ -131,10 +129,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
SectionResultData cacheServerSection = crd.addSection();
cacheServerSection.setHeader("Cache-server attributes");
- Iterator<Map<String, String>> iters = cacheServerAttributesList.iterator();
-
- while (iters.hasNext()) {
- Map<String, String> cacheServerAttributes = iters.next();
+ for (Map<String, String> cacheServerAttributes : cacheServerAttributesList) {
addSubSection(cacheServerSection, cacheServerAttributes, "");
}
}
@@ -164,7 +159,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
SectionResultData section = crd.addSection();
section.setHeader(headerText);
section.addSeparator('.');
- Set<String> attributes = new TreeSet<String>(attrMap.keySet());
+ Set<String> attributes = new TreeSet<>(attrMap.keySet());
for (String attribute : attributes) {
String attributeValue = attrMap.get(attribute);
@@ -177,7 +172,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
String headerText) {
if (!attrMap.isEmpty()) {
SectionResultData subSection = section.addSection();
- Set<String> attributes = new TreeSet<String>(attrMap.keySet());
+ Set<String> attributes = new TreeSet<>(attrMap.keySet());
subSection.setHeader(headerText);
for (String attribute : attributes) {
@@ -262,16 +257,12 @@ public class ConfigCommands extends AbstractCommandsSupport {
optionContext = ConverterHint.MEMBERGROUP,
help = CliStrings.ALTER_RUNTIME_CONFIG__MEMBER__HELP) String group,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT__HELP) Integer archiveDiskSpaceLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT__HELP) Integer archiveFileSizeLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT__HELP) Integer logDiskSpaceLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT__HELP) Integer logFileSizeLimit,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOG__LEVEL},
optionContext = ConverterHint.LOG_LEVEL,
@@ -279,31 +270,24 @@ public class ConfigCommands extends AbstractCommandsSupport {
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE},
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE__HELP) String statisticArchiveFile,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE__HELP) Integer statisticSampleRate,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED__HELP) Boolean statisticSamplingEnabled,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "false",
help = CliStrings.ALTER_RUNTIME_CONFIG__COPY__ON__READ__HELP) Boolean setCopyOnRead,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOCK__LEASE__HELP) Integer lockLease,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__LOCK__TIMEOUT__HELP) Integer lockTimeout,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__MESSAGE__SYNC__INTERVAL__HELP) Integer messageSyncInterval,
@CliOption(key = {CliStrings.ALTER_RUNTIME_CONFIG__SEARCH__TIMEOUT},
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_RUNTIME_CONFIG__SEARCH__TIMEOUT__HELP) Integer searchTimeout) {
- Map<String, String> runTimeDistributionConfigAttributes = new HashMap<String, String>();
- Map<String, String> rumTimeCacheAttributes = new HashMap<String, String>();
- Set<DistributedMember> targetMembers = new HashSet<DistributedMember>();
+ Map<String, String> runTimeDistributionConfigAttributes = new HashMap<>();
+ Map<String, String> rumTimeCacheAttributes = new HashMap<>();
+ Set<DistributedMember> targetMembers;
try {
@@ -381,7 +365,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
}
if (!runTimeDistributionConfigAttributes.isEmpty() || !rumTimeCacheAttributes.isEmpty()) {
- Map<String, String> allRunTimeAttributes = new HashMap<String, String>();
+ Map<String, String> allRunTimeAttributes = new HashMap<>();
allRunTimeAttributes.putAll(runTimeDistributionConfigAttributes);
allRunTimeAttributes.putAll(rumTimeCacheAttributes);
@@ -390,8 +374,8 @@ public class ConfigCommands extends AbstractCommandsSupport {
List<CliFunctionResult> results = CliFunctionResult.cleanResults((List<?>) rc.getResult());
CompositeResultData crd = ResultBuilder.createCompositeResultData();
TabularResultData tabularData = crd.addSection().addTable();
- Set<String> successfulMembers = new TreeSet<String>();
- Set<String> errorMessages = new TreeSet<String>();
+ Set<String> successfulMembers = new TreeSet<>();
+ Set<String> errorMessages = new TreeSet<>();
for (CliFunctionResult result : results) {
@@ -459,7 +443,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
Map<String, String> arguments = parseResult.getParamValueStrings();
// validate log level
String logLevel = arguments.get("log-level");
- if (!StringUtils.isBlank(logLevel) && (LogLevel.getLevel(logLevel) == null)) {
+ if (StringUtils.isNotBlank(logLevel) && (LogLevel.getLevel(logLevel) == null)) {
return ResultBuilder.createUserErrorResult("Invalid log level: " + logLevel);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
index 5b0651e..b8ebc49 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
@@ -14,28 +14,7 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.regex.Pattern;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.LogWriter;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.ExpirationAttributes;
@@ -52,7 +31,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.ClassPathLoader;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.security.IntegratedSecurityService;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.management.DistributedRegionMXBean;
@@ -83,14 +61,33 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Pattern;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
/**
* @since GemFire 7.0
*/
public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
- public static final Set<RegionShortcut> PERSISTENT_OVERFLOW_SHORTCUTS =
- new TreeSet<RegionShortcut>();
+ public static final Set<RegionShortcut> PERSISTENT_OVERFLOW_SHORTCUTS = new TreeSet<>();
private SecurityService securityService = IntegratedSecurityService.getSecurityService();
@@ -117,17 +114,13 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result createRegion(
@CliOption(key = CliStrings.CREATE_REGION__REGION, mandatory = true,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGION__HELP) String regionPath,
- @CliOption(key = CliStrings.CREATE_REGION__REGIONSHORTCUT, mandatory = false,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
+ @CliOption(key = CliStrings.CREATE_REGION__REGIONSHORTCUT,
help = CliStrings.CREATE_REGION__REGIONSHORTCUT__HELP) RegionShortcut regionShortcut,
@CliOption(key = CliStrings.CREATE_REGION__USEATTRIBUTESFROM,
optionContext = ConverterHint.REGION_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__USEATTRIBUTESFROM__HELP) String useAttributesFrom,
@CliOption(key = CliStrings.CREATE_REGION__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__GROUP__HELP) String[] groups,
@CliOption(key = CliStrings.CREATE_REGION__SKIPIFEXISTS, unspecifiedDefaultValue = "true",
specifiedDefaultValue = "true",
@@ -145,44 +138,32 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
help = CliStrings.CREATE_REGION__CACHEWRITER__HELP) String cacheWriter,
@CliOption(key = CliStrings.CREATE_REGION__COLOCATEDWITH,
optionContext = ConverterHint.REGION_PATH,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__COLOCATEDWITH__HELP) String prColocatedWith,
@CliOption(key = CliStrings.CREATE_REGION__COMPRESSOR,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__COMPRESSOR__HELP) String compressor,
@CliOption(key = CliStrings.CREATE_REGION__CONCURRENCYLEVEL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CONCURRENCYLEVEL__HELP) Integer concurrencyLevel,
@CliOption(key = CliStrings.CREATE_REGION__DISKSTORE,
help = CliStrings.CREATE_REGION__DISKSTORE__HELP) String diskStore,
@CliOption(key = CliStrings.CREATE_REGION__ENABLEASYNCCONFLATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENABLEASYNCCONFLATION__HELP) Boolean enableAsyncConflation,
@CliOption(key = CliStrings.CREATE_REGION__CLONINGENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CLONINGENABLED__HELP) Boolean cloningEnabled,
@CliOption(key = CliStrings.CREATE_REGION__CONCURRENCYCHECKSENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__CONCURRENCYCHECKSENABLED__HELP) Boolean concurrencyChecksEnabled,
@CliOption(key = CliStrings.CREATE_REGION__MULTICASTENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__MULTICASTENABLED__HELP) Boolean mcastEnabled,
@CliOption(key = CliStrings.CREATE_REGION__STATISTICSENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__STATISTICSENABLED__HELP) Boolean statisticsEnabled,
@CliOption(key = CliStrings.CREATE_REGION__ENABLESUBSCRIPTIONCONFLATION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENABLESUBSCRIPTIONCONFLATION__HELP) Boolean enableSubscriptionConflation,
@CliOption(key = CliStrings.CREATE_REGION__DISKSYNCHRONOUS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__DISKSYNCHRONOUS__HELP) Boolean diskSynchronous,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIME__HELP) Integer entryExpirationIdleTime,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIMEACTION,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONIDLETIMEACTION__HELP) String entryExpirationIdleTimeAction,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTIMETOLIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTIMETOLIVE__HELP) Integer entryExpirationTTL,
@CliOption(key = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTTLACTION,
help = CliStrings.CREATE_REGION__ENTRYEXPIRATIONTTLACTION__HELP) String entryExpirationTTLAction,
@@ -191,45 +172,34 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@CliOption(key = CliStrings.CREATE_REGION__KEYCONSTRAINT,
help = CliStrings.CREATE_REGION__KEYCONSTRAINT__HELP) String keyConstraint,
@CliOption(key = CliStrings.CREATE_REGION__LOCALMAXMEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__LOCALMAXMEMORY__HELP) Integer prLocalMaxMemory,
- @CliOption(key = CliStrings.CREATE_REGION__OFF_HEAP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "true",
+ @CliOption(key = CliStrings.CREATE_REGION__OFF_HEAP, specifiedDefaultValue = "true",
help = CliStrings.CREATE_REGION__OFF_HEAP__HELP) Boolean offHeap,
@CliOption(key = CliStrings.CREATE_REGION__PARTITION_RESOLVER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__PARTITION_RESOLVER__HELP) String partitionResolver,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIME__HELP) Integer regionExpirationIdleTime,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIMEACTION,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONIDLETIMEACTION__HELP) String regionExpirationIdleTimeAction,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTL__HELP) Integer regionExpirationTTL,
@CliOption(key = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTLACTION,
help = CliStrings.CREATE_REGION__REGIONEXPIRATIONTTLACTION__HELP) String regionExpirationTTLAction,
@CliOption(key = CliStrings.CREATE_REGION__RECOVERYDELAY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__RECOVERYDELAY__HELP) Long prRecoveryDelay,
@CliOption(key = CliStrings.CREATE_REGION__REDUNDANTCOPIES,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__REDUNDANTCOPIES__HELP) Integer prRedundantCopies,
@CliOption(key = CliStrings.CREATE_REGION__STARTUPRECOVERYDDELAY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__STARTUPRECOVERYDDELAY__HELP) Long prStartupRecoveryDelay,
@CliOption(key = CliStrings.CREATE_REGION__TOTALMAXMEMORY,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__TOTALMAXMEMORY__HELP) Long prTotalMaxMemory,
@CliOption(key = CliStrings.CREATE_REGION__TOTALNUMBUCKETS,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.CREATE_REGION__TOTALNUMBUCKETS__HELP) Integer prTotalNumBuckets,
@CliOption(key = CliStrings.CREATE_REGION__VALUECONSTRAINT,
help = CliStrings.CREATE_REGION__VALUECONSTRAINT__HELP) String valueConstraint
// NOTICE: keep the region attributes params in alphabetical order
) {
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
try {
@@ -271,7 +241,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
regionExpirationTTLAction);
}
- RegionFunctionArgs regionFunctionArgs = null;
+ RegionFunctionArgs regionFunctionArgs;
if (useAttributesFrom != null) {
if (!regionExists(cache, useAttributesFrom)) {
throw new IllegalArgumentException(CliStrings.format(
@@ -330,7 +300,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
validateRegionFunctionArgs(cache, regionFunctionArgs);
- Set<DistributedMember> membersToCreateRegionOn = null;
+ Set<DistributedMember> membersToCreateRegionOn;
if (groups != null && groups.length != 0) {
membersToCreateRegionOn = CliUtil.getDistributedMembersByGroup(cache, groups);
// have only normal members from the group
@@ -370,10 +340,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
result = ResultBuilder.buildResult(tabularResultData);
verifyDistributedRegionMbean(cache, regionPath);
- } catch (IllegalArgumentException e) {
- LogWrapper.getInstance().info(e.getMessage());
- result = ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
LogWrapper.getInstance().info(e.getMessage());
result = ResultBuilder.createUserErrorResult(e.getMessage());
} catch (RuntimeException e) {
@@ -406,8 +373,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
} else {
Thread.sleep(2);
}
- } catch (Exception ex) {
- continue;
+ } catch (Exception ignored) {
}
}
return false;
@@ -417,64 +383,47 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
@CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
public Result alterRegion(
@CliOption(key = CliStrings.ALTER_REGION__REGION, mandatory = true,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_REGION__REGION__HELP) String regionPath,
@CliOption(key = CliStrings.ALTER_REGION__GROUP, optionContext = ConverterHint.MEMBERGROUP,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
help = CliStrings.ALTER_REGION__GROUP__HELP) String[] groups,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIME__HELP) Integer entryExpirationIdleTime,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONIDLETIMEACTION__HELP) String entryExpirationIdleTimeAction,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTIMETOLIVE,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTIMETOLIVE__HELP) Integer entryExpirationTTL,
@CliOption(key = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTTLACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__ENTRYEXPIRATIONTTLACTION__HELP) String entryExpirationTTLAction,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIME,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIME__HELP) Integer regionExpirationIdleTime,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIMEACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONIDLETIMEACTION__HELP) String regionExpirationIdleTimeAction,
- @CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "-1",
+ @CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL, specifiedDefaultValue = "-1",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTL__HELP) Integer regionExpirationTTL,
@CliOption(key = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTLACTION,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
specifiedDefaultValue = "INVALIDATE",
help = CliStrings.ALTER_REGION__REGIONEXPIRATIONTTLACTION__HELP) String regionExpirationTTLAction,
- @CliOption(key = CliStrings.ALTER_REGION__CACHELISTENER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHELISTENER, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__CACHELISTENER__HELP) String[] cacheListeners,
- @CliOption(key = CliStrings.ALTER_REGION__CACHELOADER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "null",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHELOADER, specifiedDefaultValue = "null",
help = CliStrings.ALTER_REGION__CACHELOADER__HELP) String cacheLoader,
- @CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "null",
+ @CliOption(key = CliStrings.ALTER_REGION__CACHEWRITER, specifiedDefaultValue = "null",
help = CliStrings.ALTER_REGION__CACHEWRITER__HELP) String cacheWriter,
- @CliOption(key = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__ASYNCEVENTQUEUEID__HELP) String[] asyncEventQueueIds,
- @CliOption(key = CliStrings.ALTER_REGION__GATEWAYSENDERID,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "",
+ @CliOption(key = CliStrings.ALTER_REGION__GATEWAYSENDERID, specifiedDefaultValue = "",
help = CliStrings.ALTER_REGION__GATEWAYSENDERID__HELP) String[] gatewaySenderIds,
- @CliOption(key = CliStrings.ALTER_REGION__CLONINGENABLED,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE,
- specifiedDefaultValue = "false",
+ @CliOption(key = CliStrings.ALTER_REGION__CLONINGENABLED, specifiedDefaultValue = "false",
help = CliStrings.ALTER_REGION__CLONINGENABLED__HELP) Boolean cloningEnabled,
- @CliOption(key = CliStrings.ALTER_REGION__EVICTIONMAX,
- unspecifiedDefaultValue = CliMetaData.ANNOTATION_NULL_VALUE, specifiedDefaultValue = "0",
+ @CliOption(key = CliStrings.ALTER_REGION__EVICTIONMAX, specifiedDefaultValue = "0",
help = CliStrings.ALTER_REGION__EVICTIONMAX__HELP) Integer evictionMax) {
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
this.securityService.authorizeRegionManage(regionPath);
@@ -535,10 +484,10 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
regionExpirationTTLAction);
}
- cacheLoader = convertDefaultValue(cacheLoader, StringUtils.EMPTY_STRING);
- cacheWriter = convertDefaultValue(cacheWriter, StringUtils.EMPTY_STRING);
+ cacheLoader = convertDefaultValue(cacheLoader, StringUtils.EMPTY);
+ cacheWriter = convertDefaultValue(cacheWriter, StringUtils.EMPTY);
- RegionFunctionArgs regionFunctionArgs = null;
+ RegionFunctionArgs regionFunctionArgs;
regionFunctionArgs = new RegionFunctionArgs(regionPath, null, null, false, null, null, null,
entryIdle, entryTTL, regionIdle, regionTTL, null, null, null, null, cacheListeners,
cacheLoader, cacheWriter, asyncEventQueueIds, gatewaySenderIds, null, cloningEnabled,
@@ -599,10 +548,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
}
result = ResultBuilder.buildResult(tabularResultData);
- } catch (IllegalArgumentException e) {
- LogWrapper.getInstance().info(e.getMessage());
- result = ResultBuilder.createUserErrorResult(e.getMessage());
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
LogWrapper.getInstance().info(e.getMessage());
result = ResultBuilder.createUserErrorResult(e.getMessage());
} catch (RuntimeException e) {
@@ -624,8 +570,8 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
DistributedSystemMXBean dsMBean = managementService.getDistributedSystemMXBean();
String[] allRegionPaths = dsMBean.listAllRegionPaths();
- for (int i = 0; i < allRegionPaths.length; i++) {
- if (allRegionPaths[i].equals(regionPath)) {
+ for (String allRegionPath : allRegionPaths) {
+ if (allRegionPath.equals(regionPath)) {
regionFound = true;
break;
}
@@ -635,7 +581,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
private void validateRegionPathAndParent(InternalCache cache, String regionPath) {
- if (regionPath == null || "".equals(regionPath)) {
+ if (StringUtils.isEmpty(regionPath)) {
throw new IllegalArgumentException(CliStrings.CREATE_REGION__MSG__SPECIFY_VALID_REGION_PATH);
}
// If a region path indicates a sub-region, check whether the parent region exists
@@ -652,13 +598,13 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
private void validateGroups(InternalCache cache, String[] groups) {
if (groups != null && groups.length != 0) {
- Set<String> existingGroups = new HashSet<String>();
+ Set<String> existingGroups = new HashSet<>();
Set<DistributedMember> members = CliUtil.getAllNormalMembers(cache);
for (DistributedMember distributedMember : members) {
List<String> memberGroups = distributedMember.getGroups();
existingGroups.addAll(memberGroups);
}
- List<String> groupsList = new ArrayList<String>(Arrays.asList(groups));
+ List<String> groupsList = new ArrayList<>(Arrays.asList(groups));
groupsList.removeAll(existingGroups);
if (!groupsList.isEmpty()) {
@@ -800,8 +746,8 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
throw new IllegalArgumentException(
CliStrings.CREATE_REGION__MSG__NO_GATEWAYSENDERS_IN_THE_SYSTEM);
} else {
- List<String> gatewaySendersList = new ArrayList<String>(Arrays.asList(gatewaySenders));
- gatewaySenderIds = new HashSet<String>(gatewaySenderIds);
+ List<String> gatewaySendersList = new ArrayList<>(Arrays.asList(gatewaySenders));
+ gatewaySenderIds = new HashSet<>(gatewaySenderIds);
gatewaySenderIds.removeAll(gatewaySendersList);
if (!gatewaySenderIds.isEmpty()) {
throw new IllegalArgumentException(CliStrings.format(
@@ -874,14 +820,9 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
String compressorClassName = regionFunctionArgs.getCompressor();
Object compressor = null;
try {
- Class<?> compressorClass =
- (Class<?>) ClassPathLoader.getLatest().forName(compressorClassName);
+ Class<?> compressorClass = ClassPathLoader.getLatest().forName(compressorClassName);
compressor = compressorClass.newInstance();
- } catch (InstantiationException e) {
- compressorFailure = true;
- } catch (IllegalAccessException e) {
- compressorFailure = true;
- } catch (ClassNotFoundException e) {
+ } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
compressorFailure = true;
}
@@ -954,8 +895,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
List<?> resultsList = (List<?>) resultCollector.getResult();
if (resultsList != null && !resultsList.isEmpty()) {
- for (int i = 0; i < resultsList.size(); i++) {
- Object object = resultsList.get(i);
+ for (Object object : resultsList) {
if (object instanceof IllegalArgumentException) {
throw (IllegalArgumentException) object;
} else if (object instanceof Throwable) {
@@ -1024,7 +964,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
}
@CliCommand(value = {CliStrings.DESTROY_REGION}, help = CliStrings.DESTROY_REGION__HELP)
- @CliMetaData(shellOnly = false, relatedTopic = CliStrings.TOPIC_GEODE_REGION)
+ @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
@ResourceOperation(resource = Resource.DATA, operation = Operation.MANAGE)
public Result destroyRegion(
@CliOption(key = CliStrings.DESTROY_REGION__REGION, optionContext = ConverterHint.REGION_PATH,
@@ -1035,15 +975,14 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
.createInfoResult(CliStrings.DESTROY_REGION__MSG__SPECIFY_REGIONPATH_TO_DESTROY);
}
- if (regionPath.trim().isEmpty() || regionPath.equals(Region.SEPARATOR)) {
+ if (StringUtils.isBlank(regionPath) || regionPath.equals(Region.SEPARATOR)) {
return ResultBuilder.createInfoResult(CliStrings.format(
CliStrings.DESTROY_REGION__MSG__REGIONPATH_0_NOT_VALID, new Object[] {regionPath}));
}
- Result result = null;
+ Result result;
AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
try {
- String message = "";
InternalCache cache = getCache();
ManagementService managementService = ManagementService.getExistingManagementService(cache);
String regionPathToUse = regionPath;
@@ -1061,18 +1000,18 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
new Object[] {regionPath, "jmx-manager-update-rate milliseconds"}));
}
- CliFunctionResult destroyRegionResult = null;
+ CliFunctionResult destroyRegionResult;
ResultCollector<?, ?> resultCollector =
CliUtil.executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
List<CliFunctionResult> resultsList = (List<CliFunctionResult>) resultCollector.getResult();
- message = CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED,
+ String message = CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED,
new Object[] {regionPath, ""});
// Only if there is an error is this set to false
boolean isRegionDestroyed = true;
- for (int i = 0; i < resultsList.size(); i++) {
- destroyRegionResult = resultsList.get(i);
+ for (CliFunctionResult aResultsList : resultsList) {
+ destroyRegionResult = aResultsList;
if (destroyRegionResult.isSuccessful()) {
xmlEntity.set(destroyRegionResult.getXmlEntity());
} else if (destroyRegionResult.getThrowable() != null) {
@@ -1175,7 +1114,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport {
private Set<DistributedMember> getMembersByIds(InternalCache cache, Set<String> memberIds) {
Set<DistributedMember> foundMembers = Collections.emptySet();
if (memberIds != null && !memberIds.isEmpty()) {
- foundMembers = new HashSet<DistributedMember>();
+ foundMembers = new HashSet<>();
Set<DistributedMember> allNormalMembers = CliUtil.getAllNormalMembers(cache);
for (String memberId : memberIds) {
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
index dfd20a9..ea10182 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportImportClusterConfigurationCommands.java
@@ -14,30 +14,16 @@
*/
package org.apache.geode.management.internal.cli.commands;
-import static java.util.stream.Collectors.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import static java.util.stream.Collectors.joining;
+import static java.util.stream.Collectors.toSet;
import org.apache.commons.io.FileUtils;
-import org.apache.logging.log4j.Logger;
-import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-
+import org.apache.commons.lang.StringUtils;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.ClusterConfigurationService;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.management.cli.CliMetaData;
import org.apache.geode.management.cli.Result;
@@ -58,6 +44,20 @@ import org.apache.geode.management.internal.configuration.utils.ZipUtils;
import org.apache.geode.management.internal.security.ResourceOperation;
import org.apache.geode.security.ResourcePermission.Operation;
import org.apache.geode.security.ResourcePermission.Resource;
+import org.apache.logging.log4j.Logger;
+import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Commands for the cluster configuration
http://git-wip-us.apache.org/repos/asf/geode/blob/d16d192b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
index 9110a1a..a4ba64c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
@@ -145,11 +145,12 @@ public class IndexCommands extends AbstractCommandsSupport {
final TabularResultData indexData = ResultBuilder.createTabularResultData();
for (final IndexDetails indexDetails : indexDetailsList) {
- indexData.accumulate("Member Name", StringUtils.valueOf(indexDetails.getMemberName(), ""));
+ indexData.accumulate("Member Name",
+ StringUtils.defaultString(indexDetails.getMemberName()));
indexData.accumulate("Member ID", indexDetails.getMemberId());
indexData.accumulate("Region Path", indexDetails.getRegionPath());
indexData.accumulate("Name", indexDetails.getIndexName());
- indexData.accumulate("Type", StringUtils.valueOf(indexDetails.getIndexType(), ""));
+ indexData.accumulate("Type", StringUtils.defaultString(indexDetails.getIndexType()));
indexData.accumulate("Indexed Expression", indexDetails.getIndexedExpression());
indexData.accumulate("From Clause", indexDetails.getFromClause());
@@ -355,7 +356,7 @@ public class IndexCommands extends AbstractCommandsSupport {
// If a regionName is specified, then authorize data manage on the regionName, otherwise, it
// requires data manage permission on all regions
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(regionPath)) {
regionName = regionPath.startsWith("/") ? regionPath.substring(1) : regionPath;
this.securityService.authorizeRegionManage(regionName);
} else {
@@ -405,15 +406,15 @@ public class IndexCommands extends AbstractCommandsSupport {
if (!successfulMembers.isEmpty()) {
InfoResultData infoResult = ResultBuilder.createInfoResultData();
- if (!StringUtils.isBlank(indexName)) {
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(indexName)) {
+ if (StringUtils.isNotBlank(regionPath)) {
infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__ON__REGION__SUCCESS__MSG,
indexName, regionPath));
} else {
infoResult.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__SUCCESS__MSG, indexName));
}
} else {
- if (!StringUtils.isBlank(regionPath)) {
+ if (StringUtils.isNotBlank(regionPath)) {
infoResult.addLine(CliStrings
.format(CliStrings.DESTROY_INDEX__ON__REGION__ONLY__SUCCESS__MSG, regionPath));
} else {
@@ -431,7 +432,7 @@ public class IndexCommands extends AbstractCommandsSupport {
} else {
ErrorResultData erd = ResultBuilder.createErrorResultData();
- if (!StringUtils.isBlank(indexName)) {
+ if (StringUtils.isNotBlank(indexName)) {
erd.addLine(CliStrings.format(CliStrings.DESTROY_INDEX__FAILURE__MSG, indexName));
} else {
erd.addLine("Indexes could not be destroyed for following reasons");
@@ -668,27 +669,27 @@ public class IndexCommands extends AbstractCommandsSupport {
public String getNumberOfKeys() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfKeys(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfKeys()) : "");
}
public String getNumberOfUpdates() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfUpdates(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfUpdates()) : "");
}
public String getNumberOfValues() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getNumberOfValues(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getNumberOfValues()) : "");
}
public String getTotalUpdateTime() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getTotalUpdateTime(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getTotalUpdateTime()) : "");
}
public String getTotalUses() {
return (getIndexStatisticsDetails() != null
- ? StringUtils.valueOf(getIndexStatisticsDetails().getTotalUses(), "") : "");
+ ? StringUtils.defaultString(getIndexStatisticsDetails().getTotalUses()) : "");
}
}
[24/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/DestroyRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/DestroyRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/DestroyRegion.java
index 13fef02..de37040 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/DestroyRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/DestroyRegion.java
@@ -45,15 +45,15 @@ public class DestroyRegion extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, callbackArgPart = null;
String regionName = null;
Object callbackArg = null;
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
@@ -61,11 +61,11 @@ public class DestroyRegion extends BaseCommand {
stats.incReadDestroyRegionRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- eventPart = msg.getPart(1);
+ regionNamePart = clientMessage.getPart(0);
+ eventPart = clientMessage.getPart(1);
// callbackArgPart = null; (redundant assignment)
- if (msg.getNumberOfParts() > 2) {
- callbackArgPart = msg.getPart(2);
+ if (clientMessage.getNumberOfParts() > 2) {
+ callbackArgPart = clientMessage.getPart(2);
try {
callbackArg = callbackArgPart.getObject();
} catch (DistributedSystemDisconnectedException se) {
@@ -73,47 +73,46 @@ public class DestroyRegion extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{} ignoring message of type {} from client {} because shutdown occurred during message processing.",
- servConn.getName(), MessageType.getString(msg.getMessageType()),
- servConn.getProxyID());
+ serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
+ serverConnection.getProxyID());
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(se);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(se);
return;
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
regionName = regionNamePart.getString();
if (logger.isDebugEnabled()) {
logger.debug("{}: Received destroy region request ({} bytes) from {} for region {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName);
}
// Process the destroy region request
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.DestroyRegion_0_THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage.append(
LocalizedStrings.DestroyRegion__THE_INPUT_REGION_NAME_FOR_THE_DESTROY_REGION_REQUEST_IS_NULL
.toLocalizedString());
- writeErrorResponse(msg, MessageType.DESTROY_REGION_DATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.DESTROY_REGION_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason =
LocalizedStrings.DestroyRegion_REGION_WAS_NOT_FOUND_DURING_DESTROY_REGION_REQUEST
.toLocalizedString();
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -121,45 +120,45 @@ public class DestroyRegion extends BaseCommand {
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
try {
// user needs to have data:manage on all regions in order to destory a particular region
this.securityService.authorizeDataManage();
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
RegionDestroyOperationContext destroyContext =
authzRequest.destroyRegionAuthorize(regionName, callbackArg);
callbackArg = destroyContext.getCallbackArg();
}
// region.destroyRegion(callbackArg);
- region.basicBridgeDestroyRegion(callbackArg, servConn.getProxyID(),
+ region.basicBridgeDestroyRegion(callbackArg, serverConnection.getProxyID(),
true /* boolean from cache Client */, eventId);
} catch (DistributedSystemDisconnectedException e) {
// FIXME better exception hierarchy would avoid this check
- if (servConn.getCachedRegionHelper().getCache().getCancelCriterion()
- .cancelInProgress() != null) {
+ if (serverConnection.getCachedRegionHelper().getCache().getCancelCriterion()
+ .cancelInProgress() != null) {
if (logger.isDebugEnabled()) {
logger.debug(
"{} ignoring message of type {} from client {} because shutdown occurred during message processing.",
- servConn.getName(), MessageType.getString(msg.getMessageType()),
- servConn.getProxyID());
+ serverConnection.getName(), MessageType.getString(clientMessage.getMessageType()),
+ serverConnection.getProxyID());
}
- servConn.setFlagProcessMessagesAsFalse();
- servConn.setClientDisconnectedException(e);
+ serverConnection.setFlagProcessMessagesAsFalse();
+ serverConnection.setClientDisconnectedException(e);
} else {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
return;
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -169,10 +168,10 @@ public class DestroyRegion extends BaseCommand {
start = DistributionStats.getStatTime();
stats.incProcessDestroyRegionTime(start - oldStart);
}
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent destroy region response for region {}", servConn.getName(),
+ logger.debug("{}: Sent destroy region response for region {}", serverConnection.getName(),
regionName);
}
stats.incWriteDestroyRegionResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction.java
index e63ac22..1d0fc8c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction.java
@@ -64,21 +64,21 @@ public class ExecuteFunction extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
Object function = null;
Object args = null;
MemberMappedArgument memberMappedArg = null;
byte hasResult = 0;
try {
- hasResult = msg.getPart(0).getSerializedForm()[0];
+ hasResult = clientMessage.getPart(0).getSerializedForm()[0];
if (hasResult == 1) {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- function = msg.getPart(1).getStringOrObject();
- args = msg.getPart(2).getObject();
+ function = clientMessage.getPart(1).getStringOrObject();
+ args = clientMessage.getPart(2).getObject();
- Part part = msg.getPart(3);
+ Part part = clientMessage.getPart(3);
if (part != null) {
memberMappedArg = (MemberMappedArgument) part.getObject();
}
@@ -87,7 +87,7 @@ public class ExecuteFunction extends BaseCommand {
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -97,7 +97,7 @@ public class ExecuteFunction extends BaseCommand {
LocalizedStrings.ExecuteFunction_THE_INPUT_FUNCTION_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
.toLocalizedString();
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -110,7 +110,7 @@ public class ExecuteFunction extends BaseCommand {
final String message = LocalizedStrings.ExecuteFunction_FUNCTION_NAMED_0_IS_NOT_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
} else {
@@ -129,7 +129,7 @@ public class ExecuteFunction extends BaseCommand {
args, functionObject.optimizeForWrite());
}
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
ResultSender resultSender = new ServerToClientFunctionResultSender(m,
MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -182,7 +182,7 @@ public class ExecuteFunction extends BaseCommand {
function), ioException);
String message =
LocalizedStrings.ExecuteFunction_SERVER_COULD_NOT_SEND_THE_REPLY.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioException);
+ sendException(hasResult, clientMessage, message, servConn, ioException);
} catch (InternalFunctionInvocationTargetException internalfunctionException) {
// Fix for #44709: User should not be aware of
// InternalFunctionInvocationTargetException. No instance of
@@ -200,20 +200,20 @@ public class ExecuteFunction extends BaseCommand {
new Object[] {function}), internalfunctionException);
}
final String message = internalfunctionException.getMessage();
- sendException(hasResult, msg, message, servConn, internalfunctionException);
+ sendException(hasResult, clientMessage, message, servConn, internalfunctionException);
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
final String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
}
}
private void sendException(byte hasResult, Message msg, String message, ServerConnection servConn,
Throwable e) throws IOException {
if (hasResult == 1) {
- writeFunctionResponseException(msg, MessageType.EXCEPTION, message, servConn, e);
+ writeFunctionResponseException(msg, MessageType.EXCEPTION, servConn, e);
servConn.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction65.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction65.java
index 8fafd10..4a0a993 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction65.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction65.java
@@ -63,7 +63,7 @@ public class ExecuteFunction65 extends BaseCommand {
ExecuteFunction65() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
Object function = null;
Object args = null;
MemberMappedArgument memberMappedArg = null;
@@ -71,7 +71,7 @@ public class ExecuteFunction65 extends BaseCommand {
byte functionState = 0;
boolean isReexecute = false;
try {
- functionState = msg.getPart(0).getSerializedForm()[0];
+ functionState = clientMessage.getPart(0).getSerializedForm()[0];
if (functionState == AbstractExecution.HA_HASRESULT_NO_OPTIMIZEFORWRITE_REEXECUTE) {
functionState = AbstractExecution.HA_HASRESULT_NO_OPTIMIZEFORWRITE;
@@ -90,10 +90,10 @@ public class ExecuteFunction65 extends BaseCommand {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- function = msg.getPart(1).getStringOrObject();
- args = msg.getPart(2).getObject();
+ function = clientMessage.getPart(1).getStringOrObject();
+ args = clientMessage.getPart(2).getObject();
- Part part = msg.getPart(3);
+ Part part = clientMessage.getPart(3);
if (part != null) {
memberMappedArg = (MemberMappedArgument) part.getObject();
}
@@ -102,7 +102,7 @@ public class ExecuteFunction65 extends BaseCommand {
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -112,7 +112,7 @@ public class ExecuteFunction65 extends BaseCommand {
LocalizedStrings.ExecuteFunction_THE_INPUT_FUNCTION_FOR_THE_EXECUTE_FUNCTION_REQUEST_IS_NULL
.toLocalizedString();
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -125,7 +125,7 @@ public class ExecuteFunction65 extends BaseCommand {
final String message = LocalizedStrings.ExecuteFunction_FUNCTION_NAMED_0_IS_NOT_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
byte functionStateOnServerSide = AbstractExecution.getFunctionState(functionObject.isHA(),
@@ -139,7 +139,7 @@ public class ExecuteFunction65 extends BaseCommand {
LocalizedStrings.FunctionService_FUNCTION_ATTRIBUTE_MISMATCH_CLIENT_SERVER
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
}
@@ -159,7 +159,7 @@ public class ExecuteFunction65 extends BaseCommand {
args, functionObject.optimizeForWrite());
}
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
ResultSender resultSender = new ServerToClientFunctionResultSender65(m,
MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -193,7 +193,7 @@ public class ExecuteFunction65 extends BaseCommand {
.toLocalizedString(new Object[] {functionObject.getId(), sm}),
sm);
- sendException(hasResult, msg, e.getMessage(), servConn, e);
+ sendException(hasResult, clientMessage, e.getMessage(), servConn, e);
return;
}
functionObject.execute(context);
@@ -220,7 +220,7 @@ public class ExecuteFunction65 extends BaseCommand {
function), ioException);
String message =
LocalizedStrings.ExecuteFunction_SERVER_COULD_NOT_SEND_THE_REPLY.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioException);
+ sendException(hasResult, clientMessage, message, servConn, ioException);
} catch (InternalFunctionInvocationTargetException internalfunctionException) {
// Fix for #44709: User should not be aware of
// InternalFunctionInvocationTargetException. No instance of
@@ -236,20 +236,20 @@ public class ExecuteFunction65 extends BaseCommand {
new Object[] {function}), internalfunctionException);
}
final String message = internalfunctionException.getMessage();
- sendException(hasResult, msg, message, servConn, internalfunctionException);
+ sendException(hasResult, clientMessage, message, servConn, internalfunctionException);
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
final String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
}
}
private void sendException(byte hasResult, Message msg, String message, ServerConnection servConn,
Throwable e) throws IOException {
if (hasResult == 1) {
- writeFunctionResponseException(msg, MessageType.EXCEPTION, message, servConn, e);
+ writeFunctionResponseException(msg, MessageType.EXCEPTION, servConn, e);
servConn.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
index d007777..f4aac7a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction66.java
@@ -87,7 +87,7 @@ public class ExecuteFunction66 extends BaseCommand {
ExecuteFunction66() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
Object function = null;
Object args = null;
MemberMappedArgument memberMappedArg = null;
@@ -99,7 +99,7 @@ public class ExecuteFunction66 extends BaseCommand {
boolean ignoreFailedMembers = false;
int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
- byte[] bytes = msg.getPart(0).getSerializedForm();
+ byte[] bytes = clientMessage.getPart(0).getSerializedForm();
functionState = bytes[0];
if (bytes.length >= 5
&& servConn.getClientVersion().ordinal() >= Version.GFE_8009.ordinal()) {
@@ -123,25 +123,25 @@ public class ExecuteFunction66 extends BaseCommand {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- function = msg.getPart(1).getStringOrObject();
- args = msg.getPart(2).getObject();
+ function = clientMessage.getPart(1).getStringOrObject();
+ args = clientMessage.getPart(2).getObject();
- Part part = msg.getPart(3);
+ Part part = clientMessage.getPart(3);
if (part != null) {
memberMappedArg = (MemberMappedArgument) part.getObject();
}
- groups = getGroups(msg);
- allMembers = getAllMembers(msg);
- ignoreFailedMembers = getIgnoreFailedMembers(msg);
+ groups = getGroups(clientMessage);
+ allMembers = getAllMembers(clientMessage);
+ ignoreFailedMembers = getIgnoreFailedMembers(clientMessage);
} catch (ClassNotFoundException exception) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
} else {
- writeException(msg, exception, false, servConn);
+ writeException(clientMessage, exception, false, servConn);
}
servConn.setAsTrue(RESPONDED);
return;
@@ -153,7 +153,7 @@ public class ExecuteFunction66 extends BaseCommand {
.toLocalizedString();
logger.warn(LocalizedMessage.create(LocalizedStrings.TWO_ARG_COLON,
new Object[] {servConn.getName(), message}));
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -166,7 +166,7 @@ public class ExecuteFunction66 extends BaseCommand {
final String message = LocalizedStrings.ExecuteFunction_FUNCTION_NAMED_0_IS_NOT_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
byte functionStateOnServerSide = AbstractExecution.getFunctionState(functionObject.isHA(),
@@ -180,7 +180,7 @@ public class ExecuteFunction66 extends BaseCommand {
LocalizedStrings.FunctionService_FUNCTION_ATTRIBUTE_MISMATCH_CLIENT_SERVER
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
}
@@ -200,7 +200,7 @@ public class ExecuteFunction66 extends BaseCommand {
args, functionObject.optimizeForWrite());
}
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
ServerToClientFunctionResultSender resultSender = new ServerToClientFunctionResultSender65(m,
MessageType.EXECUTE_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -232,7 +232,7 @@ public class ExecuteFunction66 extends BaseCommand {
.toLocalizedString(new Object[] {functionObject.getId(), sm}),
sm);
- sendException(hasResult, msg, e.getMessage(), servConn, e);
+ sendException(hasResult, clientMessage, e.getMessage(), servConn, e);
return;
}
/**
@@ -252,7 +252,7 @@ public class ExecuteFunction66 extends BaseCommand {
}
if (!functionObject.hasResult()) {
- writeReply(msg, servConn);
+ writeReply(clientMessage, servConn);
}
} catch (FunctionException functionException) {
stats.endFunctionExecutionWithException(functionObject.hasResult());
@@ -269,7 +269,7 @@ public class ExecuteFunction66 extends BaseCommand {
function), ioException);
String message =
LocalizedStrings.ExecuteFunction_SERVER_COULD_NOT_SEND_THE_REPLY.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioException);
+ sendException(hasResult, clientMessage, message, servConn, ioException);
} catch (InternalFunctionInvocationTargetException internalfunctionException) {
// Fix for #44709: User should not be aware of
// InternalFunctionInvocationTargetException. No instance of
@@ -287,13 +287,13 @@ public class ExecuteFunction66 extends BaseCommand {
new Object[] {function}), internalfunctionException);
}
final String message = internalfunctionException.getMessage();
- sendException(hasResult, msg, message, servConn, internalfunctionException);
+ sendException(hasResult, clientMessage, message, servConn, internalfunctionException);
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
final String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
}
}
@@ -399,7 +399,7 @@ public class ExecuteFunction66 extends BaseCommand {
private void sendException(byte hasResult, Message msg, String message, ServerConnection servConn,
Throwable e) throws IOException {
if (hasResult == 1) {
- writeFunctionResponseException(msg, MessageType.EXCEPTION, message, servConn, e);
+ writeFunctionResponseException(msg, MessageType.EXCEPTION, servConn, e);
} else {
writeException(msg, e, false, servConn);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
index 957b423..bf5f70b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteFunction70.java
@@ -51,8 +51,8 @@ public class ExecuteFunction70 extends ExecuteFunction66 {
private ExecuteFunction70() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- super.cmdExecute(msg, servConn, start);
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ super.cmdExecute(clientMessage, serverConnection, start);
}
@Override
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
index 0007dab..3147fe5 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction.java
@@ -63,7 +63,7 @@ public class ExecuteRegionFunction extends BaseCommand {
private ExecuteRegionFunction() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
String regionName = null;
Object function = null;
Object args = null;
@@ -73,27 +73,27 @@ public class ExecuteRegionFunction extends BaseCommand {
int filterSize = 0, partNumber = 0;
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
try {
- hasResult = msg.getPart(0).getSerializedForm()[0];
+ hasResult = clientMessage.getPart(0).getSerializedForm()[0];
if (hasResult == 1) {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- regionName = msg.getPart(1).getString();
- function = msg.getPart(2).getStringOrObject();
- args = msg.getPart(3).getObject();
- Part part = msg.getPart(4);
+ regionName = clientMessage.getPart(1).getString();
+ function = clientMessage.getPart(2).getStringOrObject();
+ args = clientMessage.getPart(3).getObject();
+ Part part = clientMessage.getPart(4);
if (part != null) {
Object obj = part.getObject();
if (obj instanceof MemberMappedArgument) {
memberMappedArg = (MemberMappedArgument) obj;
}
}
- filterSize = msg.getPart(5).getInt();
+ filterSize = clientMessage.getPart(5).getInt();
if (filterSize != 0) {
filter = new HashSet();
partNumber = 6;
for (int i = 0; i < filterSize; i++) {
- filter.add(msg.getPart(partNumber + i).getStringOrObject());
+ filter.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
@@ -102,7 +102,7 @@ public class ExecuteRegionFunction extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -120,7 +120,7 @@ public class ExecuteRegionFunction extends BaseCommand {
.toLocalizedString("region");
}
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -130,7 +130,7 @@ public class ExecuteRegionFunction extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_REGION_NAMED_0_WAS_NOT_FOUND_DURING_EXECUTE_FUNCTION_REQUEST
.toLocalizedString(regionName);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -147,7 +147,7 @@ public class ExecuteRegionFunction extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_FUNCTION_0_HAS_NOT_BEEN_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
} else {
@@ -169,7 +169,7 @@ public class ExecuteRegionFunction extends BaseCommand {
// Construct execution
AbstractExecution execution = (AbstractExecution) FunctionService.onRegion(region);
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
resultSender = new ServerToClientFunctionResultSender(m,
MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -204,7 +204,7 @@ public class ExecuteRegionFunction extends BaseCommand {
function), ioe);
final String message = LocalizedStrings.ExecuteRegionFunction_SERVER_COULD_NOT_SEND_THE_REPLY
.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioe);
+ sendException(hasResult, clientMessage, message, servConn, ioe);
} catch (InternalFunctionInvocationTargetException internalfunctionException) {
// Fix for #44709: User should not be aware of
// InternalFunctionInvocationTargetException. No instance of
@@ -222,20 +222,20 @@ public class ExecuteRegionFunction extends BaseCommand {
new Object[] {function}), internalfunctionException);
}
final String message = internalfunctionException.getMessage();
- sendException(hasResult, msg, message, servConn, internalfunctionException);
+ sendException(hasResult, clientMessage, message, servConn, internalfunctionException);
} catch (FunctionException fe) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), fe);
String message = fe.getMessage();
- sendException(hasResult, msg, message, servConn, fe);
+ sendException(hasResult, clientMessage, message, servConn, fe);
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
} finally {
handShake.setClientReadTimeout(earlierClientReadTimeout);
}
@@ -245,7 +245,7 @@ public class ExecuteRegionFunction extends BaseCommand {
Throwable e) throws IOException {
synchronized (msg) {
if (hasResult == 1) {
- writeFunctionResponseException(msg, MessageType.EXCEPTION, message, servConn, e);
+ writeFunctionResponseException(msg, MessageType.EXCEPTION, servConn, e);
servConn.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction61.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction61.java
index b1d3d4e..73ab621 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction61.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction61.java
@@ -63,7 +63,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
private ExecuteRegionFunction61() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
String regionName = null;
Object function = null;
Object args = null;
@@ -76,40 +76,40 @@ public class ExecuteRegionFunction61 extends BaseCommand {
int filterSize = 0, partNumber = 0;
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
try {
- hasResult = msg.getPart(0).getSerializedForm()[0];
+ hasResult = clientMessage.getPart(0).getSerializedForm()[0];
if (hasResult == 1) {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- regionName = msg.getPart(1).getString();
- function = msg.getPart(2).getStringOrObject();
- args = msg.getPart(3).getObject();
- Part part = msg.getPart(4);
+ regionName = clientMessage.getPart(1).getString();
+ function = clientMessage.getPart(2).getStringOrObject();
+ args = clientMessage.getPart(3).getObject();
+ Part part = clientMessage.getPart(4);
if (part != null) {
Object obj = part.getObject();
if (obj instanceof MemberMappedArgument) {
memberMappedArg = (MemberMappedArgument) obj;
}
}
- isReExecute = msg.getPart(5).getSerializedForm()[0];
- filterSize = msg.getPart(6).getInt();
+ isReExecute = clientMessage.getPart(5).getSerializedForm()[0];
+ filterSize = clientMessage.getPart(6).getInt();
if (filterSize != 0) {
filter = new HashSet();
partNumber = 7;
for (int i = 0; i < filterSize; i++) {
- filter.add(msg.getPart(partNumber + i).getStringOrObject());
+ filter.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
partNumber = 7 + filterSize;
- removedNodesSize = msg.getPart(partNumber).getInt();
+ removedNodesSize = clientMessage.getPart(partNumber).getInt();
if (removedNodesSize != 0) {
removedNodesSet = new HashSet();
partNumber = partNumber + 1;
for (int i = 0; i < removedNodesSize; i++) {
- removedNodesSet.add(msg.getPart(partNumber + i).getStringOrObject());
+ removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
@@ -118,7 +118,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -136,7 +136,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
.toLocalizedString("region");
}
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
Region region = crHelper.getRegion(regionName);
@@ -145,7 +145,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_REGION_NAMED_0_WAS_NOT_FOUND_DURING_EXECUTE_FUNCTION_REQUEST
.toLocalizedString(regionName);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
HandShake handShake = (HandShake) servConn.getHandshake();
@@ -161,7 +161,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_FUNCTION_0_HAS_NOT_BEEN_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
} else {
@@ -180,7 +180,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
// Construct execution
AbstractExecution execution = (AbstractExecution) FunctionService.onRegion(region);
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
resultSender = new ServerToClientFunctionResultSender(m,
MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -220,7 +220,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
final String message =
LocalizedStrings.ExecuteRegionFunction_SERVER_COULD_NOT_SEND_THE_REPLY
.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioe);
+ sendException(hasResult, clientMessage, message, servConn, ioe);
} catch (FunctionException fe) {
String message = fe.getMessage();
@@ -255,7 +255,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), fe);
- sendException(hasResult, msg, message, servConn, fe);
+ sendException(hasResult, clientMessage, message, servConn, fe);
}
} catch (Exception e) {
@@ -263,7 +263,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
}
finally {
@@ -275,7 +275,7 @@ public class ExecuteRegionFunction61 extends BaseCommand {
private void sendException(byte hasResult, Message msg, String message, ServerConnection servConn,
Throwable e) throws IOException {
if (hasResult == 1) {
- writeFunctionResponseException(msg, MessageType.EXCEPTION, message, servConn, e);
+ writeFunctionResponseException(msg, MessageType.EXCEPTION, servConn, e);
servConn.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
index 57bc869..f1540f9 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction65.java
@@ -60,7 +60,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
private ExecuteRegionFunction65() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
String regionName = null;
Object function = null;
Object args = null;
@@ -74,7 +74,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
byte functionState = 0;
try {
- functionState = msg.getPart(0).getSerializedForm()[0];
+ functionState = clientMessage.getPart(0).getSerializedForm()[0];
if (functionState != 1) {
hasResult = (byte) ((functionState & 2) - 1);
} else {
@@ -84,35 +84,35 @@ public class ExecuteRegionFunction65 extends BaseCommand {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- regionName = msg.getPart(1).getString();
- function = msg.getPart(2).getStringOrObject();
- args = msg.getPart(3).getObject();
- Part part = msg.getPart(4);
+ regionName = clientMessage.getPart(1).getString();
+ function = clientMessage.getPart(2).getStringOrObject();
+ args = clientMessage.getPart(3).getObject();
+ Part part = clientMessage.getPart(4);
if (part != null) {
Object obj = part.getObject();
if (obj instanceof MemberMappedArgument) {
memberMappedArg = (MemberMappedArgument) obj;
}
}
- isReExecute = msg.getPart(5).getSerializedForm()[0];
- filterSize = msg.getPart(6).getInt();
+ isReExecute = clientMessage.getPart(5).getSerializedForm()[0];
+ filterSize = clientMessage.getPart(6).getInt();
if (filterSize != 0) {
filter = new HashSet<Object>();
partNumber = 7;
for (int i = 0; i < filterSize; i++) {
- filter.add(msg.getPart(partNumber + i).getStringOrObject());
+ filter.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
partNumber = 7 + filterSize;
- removedNodesSize = msg.getPart(partNumber).getInt();
+ removedNodesSize = clientMessage.getPart(partNumber).getInt();
if (removedNodesSize != 0) {
removedNodesSet = new HashSet<Object>();
partNumber = partNumber + 1;
for (int i = 0; i < removedNodesSize; i++) {
- removedNodesSet.add(msg.getPart(partNumber + i).getStringOrObject());
+ removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
@@ -121,7 +121,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -139,7 +139,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
.toLocalizedString("region");
}
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -149,7 +149,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_REGION_NAMED_0_WAS_NOT_FOUND_DURING_EXECUTE_FUNCTION_REQUEST
.toLocalizedString(regionName);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -166,7 +166,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_FUNCTION_0_HAS_NOT_BEEN_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
byte functionStateOnServerSide = AbstractExecution.getFunctionState(functionObject.isHA(),
@@ -180,7 +180,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
LocalizedStrings.FunctionService_FUNCTION_ATTRIBUTE_MISMATCH_CLIENT_SERVER
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
}
@@ -203,7 +203,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
// Construct execution
AbstractExecution execution = (AbstractExecution) FunctionService.onRegion(region);
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
resultSender = new ServerToClientFunctionResultSender65(m,
MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -262,7 +262,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
function), ioe);
final String message = LocalizedStrings.ExecuteRegionFunction_SERVER_COULD_NOT_SEND_THE_REPLY
.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioe);
+ sendException(hasResult, clientMessage, message, servConn, ioe);
} catch (FunctionException fe) {
String message = fe.getMessage();
@@ -298,7 +298,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), fe);
- sendException(hasResult, msg, message, servConn, fe);
+ sendException(hasResult, clientMessage, message, servConn, fe);
}
} catch (Exception e) {
@@ -306,7 +306,7 @@ public class ExecuteRegionFunction65 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
} finally {
handShake.setClientReadTimeout(earlierClientReadTimeout);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
index 0ed7235..25d69d6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunction66.java
@@ -64,7 +64,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
private ExecuteRegionFunction66() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
String regionName = null;
Object function = null;
Object args = null;
@@ -80,7 +80,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
byte functionState = 0;
int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
- byte[] bytes = msg.getPart(0).getSerializedForm();
+ byte[] bytes = clientMessage.getPart(0).getSerializedForm();
functionState = bytes[0];
if (bytes.length >= 5
&& servConn.getClientVersion().ordinal() >= Version.GFE_8009.ordinal()) {
@@ -95,17 +95,17 @@ public class ExecuteRegionFunction66 extends BaseCommand {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- regionName = msg.getPart(1).getString();
- function = msg.getPart(2).getStringOrObject();
- args = msg.getPart(3).getObject();
- Part part = msg.getPart(4);
+ regionName = clientMessage.getPart(1).getString();
+ function = clientMessage.getPart(2).getStringOrObject();
+ args = clientMessage.getPart(3).getObject();
+ Part part = clientMessage.getPart(4);
if (part != null) {
Object obj = part.getObject();
if (obj instanceof MemberMappedArgument) {
memberMappedArg = (MemberMappedArgument) obj;
}
}
- byte[] flags = msg.getPart(5).getSerializedForm();
+ byte[] flags = clientMessage.getPart(5).getSerializedForm();
if (servConn.getClientVersion().ordinal() > Version.GFE_81.ordinal()) {
isBucketsAsFilter = (flags[0] & ExecuteFunctionHelper.BUCKETS_AS_FILTER_MASK) != 0;
isReExecute = (flags[0] & ExecuteFunctionHelper.IS_REXECUTE_MASK) != 0 ? (byte) 1 : 0;
@@ -113,24 +113,24 @@ public class ExecuteRegionFunction66 extends BaseCommand {
isReExecute = flags[0];
isBucketsAsFilter = false;
}
- filterSize = msg.getPart(6).getInt();
+ filterSize = clientMessage.getPart(6).getInt();
if (filterSize != 0) {
filter = new HashSet<Object>();
partNumber = 7;
for (int i = 0; i < filterSize; i++) {
- filter.add(msg.getPart(partNumber + i).getStringOrObject());
+ filter.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
partNumber = 7 + filterSize;
- removedNodesSize = msg.getPart(partNumber).getInt();
+ removedNodesSize = clientMessage.getPart(partNumber).getInt();
if (removedNodesSize != 0) {
removedNodesSet = new HashSet<Object>();
partNumber = partNumber + 1;
for (int i = 0; i < removedNodesSize; i++) {
- removedNodesSet.add(msg.getPart(partNumber + i).getStringOrObject());
+ removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
@@ -139,9 +139,9 @@ public class ExecuteRegionFunction66 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
} else {
- writeException(msg, exception, false, servConn);
+ writeException(clientMessage, exception, false, servConn);
}
servConn.setAsTrue(RESPONDED);
return;
@@ -159,7 +159,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
.toLocalizedString("region");
}
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -169,7 +169,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_REGION_NAMED_0_WAS_NOT_FOUND_DURING_EXECUTE_FUNCTION_REQUEST
.toLocalizedString(regionName);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
HandShake handShake = (HandShake) servConn.getHandshake();
@@ -185,7 +185,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_FUNCTION_0_HAS_NOT_BEEN_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
byte functionStateOnServerSide = AbstractExecution.getFunctionState(functionObject.isHA(),
@@ -199,7 +199,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
LocalizedStrings.FunctionService_FUNCTION_ATTRIBUTE_MISMATCH_CLIENT_SERVER
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
}
@@ -222,7 +222,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
// Construct execution
AbstractExecution execution = (AbstractExecution) FunctionService.onRegion(region);
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
resultSender = new ServerToClientFunctionResultSender65(m,
MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -276,7 +276,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
} else {
execution.execute(functionObject);
}
- writeReply(msg, servConn);
+ writeReply(clientMessage, servConn);
}
} catch (IOException ioe) {
logger.warn(LocalizedMessage.create(
@@ -284,7 +284,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
function), ioe);
final String message = LocalizedStrings.ExecuteRegionFunction_SERVER_COULD_NOT_SEND_THE_REPLY
.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioe);
+ sendException(hasResult, clientMessage, message, servConn, ioe);
} catch (FunctionException fe) {
String message = fe.getMessage();
Object cause = fe.getCause();
@@ -321,7 +321,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), fe);
- sendException(hasResult, msg, message, servConn, fe);
+ sendException(hasResult, clientMessage, message, servConn, fe);
}
} catch (Exception e) {
@@ -329,7 +329,7 @@ public class ExecuteRegionFunction66 extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
} finally {
handShake.setClientReadTimeout(earlierClientReadTimeout);
ServerConnection.executeFunctionOnLocalNodeOnly((byte) 0);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
index 8b2cf75..725f03b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ExecuteRegionFunctionSingleHop.java
@@ -62,7 +62,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
private ExecuteRegionFunctionSingleHop() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection servConn, long start) throws IOException {
String regionName = null;
Object function = null;
@@ -79,7 +79,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
int functionTimeout = ConnectionImpl.DEFAULT_CLIENT_FUNCTION_TIMEOUT;
try {
- byte[] bytes = msg.getPart(0).getSerializedForm();
+ byte[] bytes = clientMessage.getPart(0).getSerializedForm();
functionState = bytes[0];
if (bytes.length >= 5
&& servConn.getClientVersion().ordinal() >= Version.GFE_8009.ordinal()) {
@@ -94,49 +94,49 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
servConn.setAsTrue(REQUIRES_RESPONSE);
servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
}
- regionName = msg.getPart(1).getString();
- function = msg.getPart(2).getStringOrObject();
- args = msg.getPart(3).getObject();
- Part part = msg.getPart(4);
+ regionName = clientMessage.getPart(1).getString();
+ function = clientMessage.getPart(2).getStringOrObject();
+ args = clientMessage.getPart(3).getObject();
+ Part part = clientMessage.getPart(4);
if (part != null) {
Object obj = part.getObject();
if (obj instanceof MemberMappedArgument) {
memberMappedArg = (MemberMappedArgument) obj;
}
}
- isExecuteOnAllBuckets = msg.getPart(5).getSerializedForm()[0];
+ isExecuteOnAllBuckets = clientMessage.getPart(5).getSerializedForm()[0];
if (isExecuteOnAllBuckets == 1) {
filter = new HashSet();
- bucketIdsSize = msg.getPart(6).getInt();
+ bucketIdsSize = clientMessage.getPart(6).getInt();
if (bucketIdsSize != 0) {
buckets = new HashSet<Integer>();
partNumber = 7;
for (int i = 0; i < bucketIdsSize; i++) {
- buckets.add(msg.getPart(partNumber + i).getInt());
+ buckets.add(clientMessage.getPart(partNumber + i).getInt());
}
}
partNumber = 7 + bucketIdsSize;
} else {
- filterSize = msg.getPart(6).getInt();
+ filterSize = clientMessage.getPart(6).getInt();
if (filterSize != 0) {
filter = new HashSet<Object>();
partNumber = 7;
for (int i = 0; i < filterSize; i++) {
- filter.add(msg.getPart(partNumber + i).getStringOrObject());
+ filter.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
partNumber = 7 + filterSize;
}
- removedNodesSize = msg.getPart(partNumber).getInt();
+ removedNodesSize = clientMessage.getPart(partNumber).getInt();
if (removedNodesSize != 0) {
removedNodesSet = new HashSet<Object>();
partNumber = partNumber + 1;
for (int i = 0; i < removedNodesSize; i++) {
- removedNodesSet.add(msg.getPart(partNumber + i).getStringOrObject());
+ removedNodesSet.add(clientMessage.getPart(partNumber + i).getStringOrObject());
}
}
@@ -145,7 +145,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), exception);
if (hasResult == 1) {
- writeChunkedException(msg, exception, false, servConn);
+ writeChunkedException(clientMessage, exception, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
@@ -163,7 +163,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
.toLocalizedString("region");
}
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
@@ -173,7 +173,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_REGION_NAMED_0_WAS_NOT_FOUND_DURING_EXECUTE_FUNCTION_REQUEST
.toLocalizedString(regionName);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
HandShake handShake = (HandShake) servConn.getHandshake();
@@ -189,7 +189,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
LocalizedStrings.ExecuteRegionFunction_THE_FUNCTION_0_HAS_NOT_BEEN_REGISTERED
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
} else {
byte functionStateOnServer = AbstractExecution.getFunctionState(functionObject.isHA(),
@@ -199,7 +199,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
LocalizedStrings.FunctionService_FUNCTION_ATTRIBUTE_MISMATCH_CLIENT_SERVER
.toLocalizedString(function);
logger.warn("{}: {}", servConn.getName(), message);
- sendError(hasResult, msg, message, servConn);
+ sendError(hasResult, clientMessage, message, servConn);
return;
}
}
@@ -222,7 +222,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
// Construct execution
AbstractExecution execution = (AbstractExecution) FunctionService.onRegion(region);
ChunkedMessage m = servConn.getFunctionResponseMessage();
- m.setTransactionId(msg.getTransactionId());
+ m.setTransactionId(clientMessage.getTransactionId());
resultSender = new ServerToClientFunctionResultSender65(m,
MessageType.EXECUTE_REGION_FUNCTION_RESULT, servConn, functionObject, executeContext);
@@ -290,7 +290,7 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
function), ioe);
final String message = LocalizedStrings.ExecuteRegionFunction_SERVER_COULD_NOT_SEND_THE_REPLY
.toLocalizedString();
- sendException(hasResult, msg, message, servConn, ioe);
+ sendException(hasResult, clientMessage, message, servConn, ioe);
} catch (FunctionException fe) {
String message = fe.getMessage();
@@ -301,21 +301,21 @@ public class ExecuteRegionFunctionSingleHop extends BaseCommand {
logger.debug("Exception on server while executing function: {}: {}", function, message,
fe);
}
- synchronized (msg) {
+ synchronized (clientMessage) {
resultSender.setException(fe);
}
} else {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), fe);
- sendException(hasResult, msg, message, servConn, fe);
+ sendException(hasResult, clientMessage, message, servConn, fe);
}
} catch (Exception e) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.ExecuteRegionFunction_EXCEPTION_ON_SERVER_WHILE_EXECUTIONG_FUNCTION_0,
function), e);
String message = e.getMessage();
- sendException(hasResult, msg, message, servConn, e);
+ sendException(hasResult, clientMessage, message, servConn, e);
} finally {
handShake.setClientReadTimeout(earlierClientReadTimeout);
ServerConnection.executeFunctionOnLocalNodeOnly((byte) 0);
[22/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetFunctionAttribute.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetFunctionAttribute.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetFunctionAttribute.java
index 8ec16ef..f56a4d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetFunctionAttribute.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetFunctionAttribute.java
@@ -34,15 +34,15 @@ public class GetFunctionAttribute extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- String functionId = msg.getPart(0).getString();
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ String functionId = clientMessage.getPart(0).getString();
if (functionId == null) {
String message =
LocalizedStrings.GetFunctionAttribute_THE_INPUT_0_FOR_GET_FUNCTION_ATTRIBUTE_REQUEST_IS_NULL
.toLocalizedString("functionId");
- logger.warn("{}: {}", servConn.getName(), message);
- sendError(msg, message, servConn);
+ logger.warn("{}: {}", serverConnection.getName(), message);
+ sendError(clientMessage, message, serverConnection);
return;
}
@@ -52,8 +52,8 @@ public class GetFunctionAttribute extends BaseCommand {
message =
LocalizedStrings.GetFunctionAttribute_THE_FUNCTION_IS_NOT_REGISTERED_FOR_FUNCTION_ID_0
.toLocalizedString(functionId);
- logger.warn("{}: {}", servConn.getName(), message);
- sendError(msg, message, servConn);
+ logger.warn("{}: {}", serverConnection.getName(), message);
+ sendError(clientMessage, message, serverConnection);
return;
}
@@ -61,7 +61,7 @@ public class GetFunctionAttribute extends BaseCommand {
functionAttributes[0] = (byte) (function.hasResult() ? 1 : 0);
functionAttributes[1] = (byte) (function.isHA() ? 1 : 0);
functionAttributes[2] = (byte) (function.optimizeForWrite() ? 1 : 0);
- writeResponseWithFunctionAttribute(functionAttributes, msg, servConn);
+ writeResponseWithFunctionAttribute(functionAttributes, clientMessage, serverConnection);
}
private void sendError(Message msg, String message, ServerConnection servConn)
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXEnumById.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXEnumById.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXEnumById.java
index 54a21ed..cc7dd05 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXEnumById.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXEnumById.java
@@ -36,32 +36,32 @@ public class GetPDXEnumById extends BaseCommand {
private GetPDXEnumById() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received get pdx enum by id request ({} parts) from {}", servConn.getName(),
- msg.getNumberOfParts(), servConn.getSocketString());
+ logger.debug("{}: Received get pdx enum by id request ({} parts) from {}", serverConnection.getName(),
+ clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int enumId = msg.getPart(0).getInt();
+ int enumId = clientMessage.getPart(0).getInt();
EnumInfo result;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
result = registry.getEnumInfoById(enumId);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(result);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForEnum.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForEnum.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForEnum.java
index 1b21383..7bf5b4f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForEnum.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForEnum.java
@@ -36,33 +36,33 @@ public class GetPDXIdForEnum extends BaseCommand {
private GetPDXIdForEnum() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx id for enum request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- EnumInfo enumInfo = (EnumInfo) msg.getPart(0).getObject();
+ EnumInfo enumInfo = (EnumInfo) clientMessage.getPart(0).getObject();
int enumId;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
enumId = registry.defineEnum(enumInfo);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addIntPart(enumId);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForType.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForType.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForType.java
index 2054196..e5dc5f0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForType.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXIdForType.java
@@ -36,34 +36,34 @@ public class GetPDXIdForType extends BaseCommand {
private GetPDXIdForType() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx id for type request ({} parts) from {}",
- servConn.getName(), msg.getNumberOfParts(), servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int noOfParts = msg.getNumberOfParts();
+ int noOfParts = clientMessage.getNumberOfParts();
- PdxType type = (PdxType) msg.getPart(0).getObject();
+ PdxType type = (PdxType) clientMessage.getPart(0).getObject();
int pdxId;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
pdxId = registry.defineType(type);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addIntPart(pdxId);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXTypeById.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXTypeById.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXTypeById.java
index 2470893..032e8b3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXTypeById.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPDXTypeById.java
@@ -36,32 +36,32 @@ public class GetPDXTypeById extends BaseCommand {
private GetPDXTypeById() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received get pdx type by id request ({} parts) from {}", servConn.getName(),
- msg.getNumberOfParts(), servConn.getSocketString());
+ logger.debug("{}: Received get pdx type by id request ({} parts) from {}", serverConnection.getName(),
+ clientMessage.getNumberOfParts(), serverConnection.getSocketString());
}
- int pdxId = msg.getPart(0).getInt();
+ int pdxId = clientMessage.getPart(0).getInt();
PdxType type;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
TypeRegistry registry = cache.getPdxRegistry();
type = registry.getType(pdxId);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(type);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxEnums70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxEnums70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxEnums70.java
index 19551c4..7753584 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxEnums70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxEnums70.java
@@ -36,31 +36,31 @@ public class GetPdxEnums70 extends BaseCommand {
private GetPdxEnums70() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received get pdx enums from {}", servConn.getName(),
- servConn.getSocketString());
+ logger.debug("{}: Received get pdx enums from {}", serverConnection.getName(),
+ serverConnection.getSocketString());
}
Map<Integer, EnumInfo> enums;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
enums = cache.getPdxRegistry().enumMap();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(enums);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxTypes70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxTypes70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxTypes70.java
index cc96b8e..c31a375 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxTypes70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/GetPdxTypes70.java
@@ -36,30 +36,30 @@ public class GetPdxTypes70 extends BaseCommand {
private GetPdxTypes70() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received get pdx types from {}", servConn.getName(),
- servConn.getSocketString());
+ logger.debug("{}: Received get pdx types from {}", serverConnection.getName(),
+ serverConnection.getSocketString());
}
Map<Integer, PdxType> types;
try {
- InternalCache cache = servConn.getCache();
+ InternalCache cache = serverConnection.getCache();
types = cache.getPdxRegistry().typeMap();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- Message responseMsg = servConn.getResponseMessage();
+ Message responseMsg = serverConnection.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
- responseMsg.setTransactionId(msg.getTransactionId());
+ responseMsg.setTransactionId(clientMessage.getTransactionId());
responseMsg.addObjPart(types);
- responseMsg.send(servConn);
- servConn.setAsTrue(RESPONDED);
+ responseMsg.send(serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalid.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalid.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalid.java
index 24d623a..314ba07 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalid.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalid.java
@@ -36,12 +36,13 @@ public class Invalid extends BaseCommand {
private Invalid() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
logger.error(
LocalizedMessage.create(LocalizedStrings.Invalid_0_INVALID_MESSAGE_TYPE_WITH_TX_1_FROM_2,
- new Object[] {servConn.getName(), Integer.valueOf(msg.getTransactionId()),
- servConn.getSocketString()}));
- writeErrorResponse(msg, MessageType.INVALID, servConn);
+ new Object[] {
+ serverConnection.getName(), Integer.valueOf(clientMessage.getTransactionId()),
+ serverConnection.getSocketString()}));
+ writeErrorResponse(clientMessage, MessageType.INVALID, serverConnection);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate.java
index 42b2497..22bf6f4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate.java
@@ -48,15 +48,15 @@ public class Invalidate extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null, callbackArgPart = null;
String regionName = null;
Object callbackArg = null, key = null;
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
- CacheServerStats stats = servConn.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ CacheServerStats stats = serverConnection.getCacheServerStats();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
@@ -64,17 +64,17 @@ public class Invalidate extends BaseCommand {
stats.incReadInvalidateRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
- eventPart = msg.getPart(2);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
+ eventPart = clientMessage.getPart(2);
// callbackArgPart = null; (redundant assignment)
- if (msg.getNumberOfParts() > 3) {
- callbackArgPart = msg.getPart(3);
+ if (clientMessage.getNumberOfParts() > 3) {
+ callbackArgPart = clientMessage.getPart(3);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -82,14 +82,14 @@ public class Invalidate extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
- logger.debug(servConn.getName() + ": Received invalidate request (" + msg.getPayloadLength()
- + " bytes) from " + servConn.getSocketString() + " for region " + regionName + " key "
- + key);
+ logger.debug(serverConnection.getName() + ": Received invalidate request (" + clientMessage.getPayloadLength()
+ + " bytes) from " + serverConnection.getSocketString() + " for region " + regionName + " key "
+ + key);
}
// Process the invalidate request
@@ -108,23 +108,23 @@ public class Invalidate extends BaseCommand {
.append(LocalizedStrings.BaseCommand__THE_INPUT_REGION_NAME_FOR_THE_0_REQUEST_IS_NULL
.toLocalizedString("invalidate"));
}
- writeErrorResponse(msg, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.DESTROY_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.BaseCommand__0_WAS_NOT_FOUND_DURING_1_REQUEST
.toLocalizedString(regionName, "invalidate");
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Invalidate the entry
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
Breadcrumbs.setEventId(eventId);
@@ -134,7 +134,7 @@ public class Invalidate extends BaseCommand {
// for integrated security
this.securityService.authorizeRegionWrite(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
InvalidateOperationContext invalidateContext =
authzRequest.invalidateAuthorize(regionName, key, callbackArg);
@@ -143,7 +143,7 @@ public class Invalidate extends BaseCommand {
EventIDHolder clientEvent = new EventIDHolder(eventId);
// msg.isRetry might be set by v7.0 and later clients
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// if (logger.isDebugEnabled()) {
// logger.debug("DEBUG: encountered isRetry in Invalidate");
// }
@@ -157,9 +157,9 @@ public class Invalidate extends BaseCommand {
}
}
- region.basicBridgeInvalidate(key, callbackArg, servConn.getProxyID(), true, clientEvent);
+ region.basicBridgeInvalidate(key, callbackArg, serverConnection.getProxyID(), true, clientEvent);
tag = clientEvent.getVersionTag();
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} catch (EntryNotFoundException e) {
// Don't send an exception back to the client if this
// exception happens. Just log it and continue.
@@ -167,25 +167,25 @@ public class Invalidate extends BaseCommand {
LocalizedStrings.BaseCommand_DURING_0_NO_ENTRY_WAS_FOUND_FOR_KEY_1,
new Object[] {"invalidate", key}));
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// If an exception occurs during the destroy, preserve the connection
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (e instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), e);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), e);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.BaseCommand_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), e);
+ serverConnection.getName()), e);
}
return;
}
@@ -199,17 +199,17 @@ public class Invalidate extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, pr.getNetworkHopType(), tag);
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, pr.getNetworkHopType(), tag);
pr.clearNetworkHopData();
} else {
- writeReply(msg, servConn, tag);
+ writeReply(clientMessage, serverConnection, tag);
}
} else {
- writeReply(msg, servConn, tag);
+ writeReply(clientMessage, serverConnection, tag);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent invalidate response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent invalidate response for region {} key {}", serverConnection.getName(),
regionName, key);
}
stats.incWriteInvalidateResponseTime(DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate70.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate70.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate70.java
index 4ac5023..2531e1d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate70.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Invalidate70.java
@@ -60,7 +60,7 @@ public class Invalidate70 extends Invalidate {
pr.getPrStats().incPRMetaDataSentCount();
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
@@ -90,7 +90,7 @@ public class Invalidate70 extends Invalidate {
logger.debug("response has no version tag");
}
}
- replyMsg.addBytesPart(OK_BYTES); // make old single-hop code happy by putting byte[]{0} here
+ replyMsg.addBytesPart(okBytes()); // make old single-hop code happy by putting byte[]{0} here
replyMsg.send(servConn);
if (logger.isTraceEnabled()) {
logger.trace("{}: rpl tx: {} parts={}", servConn.getName(), origMsg.getTransactionId(),
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/KeySet.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/KeySet.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/KeySet.java
index 5f7388c..a35c4b0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/KeySet.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/KeySet.java
@@ -26,7 +26,6 @@ import java.util.Set;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.operations.KeySetOperationContext;
import org.apache.geode.internal.cache.LocalRegion;
-import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.MessageType;
import org.apache.geode.internal.cache.tier.sockets.BaseCommand;
@@ -49,21 +48,21 @@ public class KeySet extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null;
String regionName = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// Retrieve the region name from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
- ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getChunkedResponseMessage();
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
logger.debug("{}: Received key set request ({} bytes) from {} for region {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName);
}
// Process the key set request
@@ -72,41 +71,41 @@ public class KeySet extends BaseCommand {
// if (regionName == null) (can only be null)
{
message = LocalizedStrings.KeySet_0_THE_INPUT_REGION_NAME_FOR_THE_KEY_SET_REQUEST_IS_NULL
- .toLocalizedString(servConn.getName());
+ .toLocalizedString(serverConnection.getName());
logger.warn(LocalizedMessage.create(
LocalizedStrings.KeySet_0_THE_INPUT_REGION_NAME_FOR_THE_KEY_SET_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
}
- writeKeySetErrorResponse(msg, MessageType.KEY_SET_DATA_ERROR, message, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeKeySetErrorResponse(clientMessage, MessageType.KEY_SET_DATA_ERROR, message, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.KeySet__0_WAS_NOT_FOUND_DURING_KEY_SET_REQUEST
.toLocalizedString(regionName);
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
try {
this.securityService.authorizeRegionRead(regionName);
} catch (NotAuthorizedException ex) {
- writeChunkedException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
KeySetOperationContext keySetContext = null;
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
try {
keySetContext = authzRequest.keySetAuthorize(regionName);
} catch (NotAuthorizedException ex) {
- writeChunkedException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -117,20 +116,20 @@ public class KeySet extends BaseCommand {
// Send header
chunkedResponseMsg.setMessageType(MessageType.RESPONSE);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendKeySetResponseChunks(region, regionName, keySetContext, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendKeySetResponseChunks(region, regionName, keySetContext, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn, servConn.getChunkedResponseMessage());
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection, serverConnection.getChunkedResponseMessage());
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -138,7 +137,7 @@ public class KeySet extends BaseCommand {
// logger.fine(getName() + ": Sent chunk (1 of 1) of register interest
// response (" + chunkedResponseMsg.getBufferLength() + " bytes) for
// region " + regionName + " key " + key);
- logger.debug("{}: Sent key set response for the region {}", servConn.getName(), regionName);
+ logger.debug("{}: Sent key set response for the region {}", serverConnection.getName(), regionName);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
// DistributionStats.getStatTime() - start);
@@ -160,7 +159,7 @@ public class KeySet extends BaseCommand {
keySet = keySetContext.getKeySet();
}
- List keyList = new ArrayList(maximumChunkSize);
+ List keyList = new ArrayList(MAXIMUM_CHUNK_SIZE);
final boolean isTraceEnabled = logger.isTraceEnabled();
for (Iterator it = keySet.iterator(); it.hasNext();) {
Object entryKey = it.next();
@@ -169,7 +168,7 @@ public class KeySet extends BaseCommand {
logger.trace("{}: fillAndSendKeySetResponseKey <{}>; list size was {}; region: {}",
servConn.getName(), entryKey, keyList.size(), region.getFullPath());
}
- if (keyList.size() == maximumChunkSize) {
+ if (keyList.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendKeySetResponseChunk(region, keyList, false, servConn);
keyList.clear();
@@ -185,7 +184,7 @@ public class KeySet extends BaseCommand {
chunkedResponseMsg.setNumberOfParts(1);
chunkedResponseMsg.setLastChunk(lastChunk);
- chunkedResponseMsg.addObjPart(list, zipValues);
+ chunkedResponseMsg.addObjPart(list, false);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sending {} key set response chunk for region={}{}", servConn.getName(),
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MakePrimary.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MakePrimary.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MakePrimary.java
index fc8fe44..0786990 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MakePrimary.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/MakePrimary.java
@@ -34,30 +34,30 @@ public class MakePrimary extends BaseCommand {
private MakePrimary() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- Part isClientReadyPart = msg.getPart(0);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ Part isClientReadyPart = clientMessage.getPart(0);
byte[] isClientReadyPartBytes = (byte[]) isClientReadyPart.getObject();
boolean isClientReady = isClientReadyPartBytes[0] == 0x01;
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
logger.debug("{}: Received make primary request ({} bytes) isClientReady={}: from {}",
- servConn.getName(), msg.getPayloadLength(), isClientReady, servConn.getSocketString());
+ serverConnection.getName(), clientMessage.getPayloadLength(), isClientReady, serverConnection.getSocketString());
}
try {
- servConn.getAcceptor().getCacheClientNotifier().makePrimary(servConn.getProxyID(),
+ serverConnection.getAcceptor().getCacheClientNotifier().makePrimary(serverConnection.getProxyID(),
isClientReady);
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (isDebugEnabled) {
- logger.debug("{}: Sent make primary response for {}", servConn.getName(),
- servConn.getSocketString());
+ logger.debug("{}: Sent make primary response for {}", serverConnection.getName(),
+ serverConnection.getSocketString());
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ManagementCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ManagementCommand.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ManagementCommand.java
index b5e1ca3..9a79540 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ManagementCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/ManagementCommand.java
@@ -28,7 +28,7 @@ import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
public class ManagementCommand extends BaseCommand {
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
// TODO Auto-generated method stub
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PeriodicAck.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PeriodicAck.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PeriodicAck.java
index d301909..e57385f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PeriodicAck.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/PeriodicAck.java
@@ -33,43 +33,43 @@ public class PeriodicAck extends BaseCommand {
private PeriodicAck() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException {
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
- logger.debug("{}: Received periodic ack request ({} bytes) from {}", servConn.getName(),
- msg.getPayloadLength(), servConn.getSocketString());
+ logger.debug("{}: Received periodic ack request ({} bytes) from {}", serverConnection.getName(),
+ clientMessage.getPayloadLength(), serverConnection.getSocketString());
}
try {
- int numEvents = msg.getNumberOfParts();
+ int numEvents = clientMessage.getNumberOfParts();
boolean success = false;
- CacheClientNotifier ccn = servConn.getAcceptor().getCacheClientNotifier();
- CacheClientProxy proxy = ccn.getClientProxy(servConn.getProxyID());
+ CacheClientNotifier ccn = serverConnection.getAcceptor().getCacheClientNotifier();
+ CacheClientProxy proxy = ccn.getClientProxy(serverConnection.getProxyID());
if (proxy != null) {
proxy.getHARegionQueue().createAckedEventsMap();
for (int i = 0; i < numEvents; i++) {
- Part eventIdPart = msg.getPart(i);
- eventIdPart.setVersion(servConn.getClientVersion());
+ Part eventIdPart = clientMessage.getPart(i);
+ eventIdPart.setVersion(serverConnection.getClientVersion());
EventID eid = (EventID) eventIdPart.getObject();
- success = ccn.processDispatchedMessage(servConn.getProxyID(), eid);
+ success = ccn.processDispatchedMessage(serverConnection.getProxyID(), eid);
if (!success)
break;
}
}
if (success) {
proxy.getHARegionQueue().setAckedEvents();
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sent periodic ack response for {}", servConn.getName(),
- servConn.getSocketString());
+ logger.debug("{}: Sent periodic ack response for {}", serverConnection.getName(),
+ serverConnection.getSocketString());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
index 7a12ce1..9755410 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Ping.java
@@ -39,35 +39,35 @@ public class Ping extends BaseCommand {
private Ping() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
- logger.debug("{}: rcv tx: {} from {} rcvTime: {}", servConn.getName(), msg.getTransactionId(),
- servConn.getSocketString(), (DistributionStats.getStatTime() - start));
+ logger.debug("{}: rcv tx: {} from {} rcvTime: {}", serverConnection.getName(), clientMessage.getTransactionId(),
+ serverConnection.getSocketString(), (DistributionStats.getStatTime() - start));
}
ClientHealthMonitor chm = ClientHealthMonitor.getInstance();
if (chm != null)
- chm.receivedPing(servConn.getProxyID());
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ chm.receivedPing(serverConnection.getProxyID());
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
- writeReply(msg, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeReply(clientMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (isDebugEnabled) {
- logger.debug("{}: Sent ping reply to {}", servConn.getName(), servConn.getSocketString());
+ logger.debug("{}: Sent ping reply to {}", serverConnection.getName(), serverConnection.getSocketString());
}
}
@Override
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
- Message replyMsg = servConn.getReplyMessage();
- servConn.getCache().getCancelCriterion().checkCancelInProgress(null);
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
+ Message replyMsg = serverConnection.getReplyMessage();
+ serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null);
replyMsg.setMessageType(MessageType.REPLY);
replyMsg.setNumberOfParts(1);
replyMsg.setTransactionId(origMsg.getTransactionId());
- replyMsg.addBytesPart(OK_BYTES);
- replyMsg.send(servConn);
+ replyMsg.addBytesPart(okBytes());
+ replyMsg.send(serverConnection);
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl tx: {}", servConn.getName(), origMsg.getTransactionId());
+ logger.trace("{}: rpl tx: {}", serverConnection.getName(), origMsg.getTransactionId());
}
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put.java
index 2a235c0..d724f66 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put.java
@@ -49,36 +49,36 @@ public class Put extends BaseCommand {
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
String regionName = null;
Object callbackArg = null, key = null;
Part eventPart = null;
String errMessage = "";
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadPutRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
- valuePart = msg.getPart(2);
- eventPart = msg.getPart(3);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
+ valuePart = clientMessage.getPart(2);
+ eventPart = clientMessage.getPart(3);
// callbackArgPart = null; (redundant assignment)
- if (msg.getNumberOfParts() > 4) {
- callbackArgPart = msg.getPart(4);
+ if (clientMessage.getNumberOfParts() > 4) {
+ callbackArgPart = clientMessage.getPart(4);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -87,14 +87,14 @@ public class Put extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isTraceEnabled()) {
logger.trace("{}: Received put request ({} bytes) from {} for region {} key {} value {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key,
valuePart);
}
@@ -102,28 +102,28 @@ public class Put extends BaseCommand {
if (key == null || regionName == null) {
if (key == null) {
logger.warn(LocalizedMessage.create(
- LocalizedStrings.Put_0_THE_INPUT_KEY_FOR_THE_PUT_REQUEST_IS_NULL, servConn.getName()));
+ LocalizedStrings.Put_0_THE_INPUT_KEY_FOR_THE_PUT_REQUEST_IS_NULL, serverConnection.getName()));
errMessage =
LocalizedStrings.Put_THE_INPUT_KEY_FOR_THE_PUT_REQUEST_IS_NULL.toLocalizedString();
}
if (regionName == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.Put_0_THE_INPUT_REGION_NAME_FOR_THE_PUT_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage = LocalizedStrings.Put_THE_INPUT_REGION_NAME_FOR_THE_PUT_REQUEST_IS_NULL
.toLocalizedString();
}
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason =
LocalizedStrings.Put_REGION_WAS_NOT_FOUND_DURING_PUT_REQUEST.toLocalizedString();
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -131,18 +131,18 @@ public class Put extends BaseCommand {
// Invalid to 'put' a null value in an existing key
logger.info(LocalizedMessage.create(
LocalizedStrings.Put_0_ATTEMPTED_TO_PUT_A_NULL_VALUE_FOR_EXISTING_KEY_1,
- new Object[] {servConn.getName(), key}));
+ new Object[] { serverConnection.getName(), key}));
errMessage =
LocalizedStrings.Put_ATTEMPTED_TO_PUT_A_NULL_VALUE_FOR_EXISTING_KEY_0.toLocalizedString();
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
try {
byte[] value = valuePart.getSerializedForm();
@@ -150,7 +150,7 @@ public class Put extends BaseCommand {
this.securityService.authorizeRegionWrite(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
authzRequest.createRegionAuthorize((String) key);
@@ -173,46 +173,46 @@ public class Put extends BaseCommand {
// Create the null entry. Since the value is null, the value of the
// isObject
// the true after null doesn't matter and is not used.
- result = region.basicBridgeCreate(key, null, true, callbackArg, servConn.getProxyID(), true,
+ result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true,
new EventIDHolder(eventId), false);
} else {
// Put the entry
result = region.basicBridgePut(key, value, null, isObject, callbackArg,
- servConn.getProxyID(), true, new EventIDHolder(eventId));
+ serverConnection.getProxyID(), true, new EventIDHolder(eventId));
}
if (result) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} else {
StringId message = LocalizedStrings.PUT_0_FAILED_TO_PUT_ENTRY_FOR_REGION_1_KEY_2_VALUE_3;
- Object[] messageArgs = new Object[] {servConn.getName(), regionName, key, valuePart};
+ Object[] messageArgs = new Object[] { serverConnection.getName(), regionName, key, valuePart};
String s = message.toLocalizedString(messageArgs);
logger.info(s);
throw new Exception(s);
}
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, re, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ce, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (ce instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (logger.isDebugEnabled()) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), ce);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.PUT_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), ce);
+ serverConnection.getName()), ce);
}
return;
} finally {
@@ -222,12 +222,12 @@ public class Put extends BaseCommand {
}
// Increment statistics and write the reply
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
logger.debug("{}: Sent put response back to {} for region {} key {} value {}",
- servConn.getName(), servConn.getSocketString(), regionName, key, valuePart);
+ serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
}
stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put61.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put61.java
index d123ea2..3f9a72e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put61.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put61.java
@@ -55,7 +55,7 @@ public class Put61 extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long p_start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long p_start)
throws IOException, InterruptedException {
long start = p_start;
Part regionNamePart = null, keyPart = null, valuePart = null, callbackArgPart = null;
@@ -64,36 +64,36 @@ public class Put61 extends BaseCommand {
Part eventPart = null;
StringBuffer errMessage = new StringBuffer();
boolean isDelta = false;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
// requiresResponse = true;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
stats.incReadPutRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
try {
- isDelta = (Boolean) msg.getPart(2).getObject();
+ isDelta = (Boolean) clientMessage.getPart(2).getObject();
} catch (Exception e) {
- writeException(msg, MessageType.PUT_DELTA_ERROR, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, MessageType.PUT_DELTA_ERROR, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
// CachePerfStats not available here.
return;
}
- valuePart = msg.getPart(3);
- eventPart = msg.getPart(4);
- if (msg.getNumberOfParts() > 5) {
- callbackArgPart = msg.getPart(5);
+ valuePart = clientMessage.getPart(3);
+ eventPart = clientMessage.getPart(4);
+ if (clientMessage.getNumberOfParts() > 5) {
+ callbackArgPart = clientMessage.getPart(5);
try {
callbackArg = callbackArgPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -102,16 +102,16 @@ public class Put61 extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
logger.debug("{}: Received 6.1{}put request ({} bytes) from {} for region {} key {}",
- servConn.getName(), (isDelta ? " delta " : " "), msg.getPayloadLength(),
- servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), (isDelta ? " delta " : " "), clientMessage.getPayloadLength(),
+ serverConnection.getSocketString(), regionName, key);
}
// Process the put request
@@ -119,27 +119,27 @@ public class Put61 extends BaseCommand {
if (key == null) {
String putMsg = " The input key for the 6.1 put request is null";
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
}
if (regionName == null) {
String putMsg = " The input region name for the 6.1 put request is null";
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
}
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during 6.1 put request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -147,11 +147,11 @@ public class Put61 extends BaseCommand {
// Invalid to 'put' a null value in an existing key
String putMsg = " Attempted to 6.1 put a null value for existing key " + key;
if (isDebugEnabled) {
- logger.debug("{}:{}", servConn.getName(), putMsg);
+ logger.debug("{}:{}", serverConnection.getName(), putMsg);
}
errMessage.append(putMsg);
- writeErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -160,7 +160,7 @@ public class Put61 extends BaseCommand {
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
try {
Object value = null;
@@ -169,13 +169,13 @@ public class Put61 extends BaseCommand {
}
boolean isObject = valuePart.isObject();
boolean isMetaRegion = region.isUsedForMetaRegion();
- msg.setMetaRegion(isMetaRegion);
+ clientMessage.setMetaRegion(isMetaRegion);
this.securityService.authorizeRegionWrite(regionName, key.toString());
AuthorizeRequest authzRequest = null;
if (!isMetaRegion) {
- authzRequest = servConn.getAuthzRequest();
+ authzRequest = serverConnection.getAuthzRequest();
}
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
@@ -199,7 +199,7 @@ public class Put61 extends BaseCommand {
// Create the null entry. Since the value is null, the value of the
// isObject
// the true after null doesn't matter and is not used.
- result = region.basicBridgeCreate(key, null, true, callbackArg, servConn.getProxyID(), true,
+ result = region.basicBridgeCreate(key, null, true, callbackArg, serverConnection.getProxyID(), true,
new EventIDHolder(eventId), false);
} else {
// Put the entry
@@ -208,50 +208,50 @@ public class Put61 extends BaseCommand {
delta = valuePart.getSerializedForm();
}
result = region.basicBridgePut(key, value, delta, isObject, callbackArg,
- servConn.getProxyID(), true, new EventIDHolder(eventId));
+ serverConnection.getProxyID(), true, new EventIDHolder(eventId));
}
if (result) {
- servConn.setModificationInfo(true, regionName, key);
+ serverConnection.setModificationInfo(true, regionName, key);
} else {
- String message = servConn.getName() + ": Failed to 6.1 put entry for region " + regionName
- + " key " + key + " value " + valuePart;
+ String message = serverConnection.getName() + ": Failed to 6.1 put entry for region " + regionName
+ + " key " + key + " value " + valuePart;
if (isDebugEnabled) {
logger.debug(message);
}
throw new Exception(message);
}
} catch (RegionDestroyedException rde) {
- writeException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, rde, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, re, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (InvalidDeltaException ide) {
logger.info(LocalizedMessage.create(
LocalizedStrings.UpdateOperation_ERROR_APPLYING_DELTA_FOR_KEY_0_OF_REGION_1,
new Object[] {key, regionName}));
- writeException(msg, MessageType.PUT_DELTA_ERROR, ide, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, MessageType.PUT_DELTA_ERROR, ide, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
region.getCachePerfStats().incDeltaFullValuesRequested();
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the put, preserve the connection
- writeException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ce, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
if (ce instanceof GemFireSecurityException) {
// Fine logging for security exceptions since these are already
// logged by the security logger
if (isDebugEnabled) {
- logger.debug("{}: Unexpected Security exception", servConn.getName(), ce);
+ logger.debug("{}: Unexpected Security exception", serverConnection.getName(), ce);
}
} else if (isDebugEnabled) {
- logger.debug("{}: Unexpected Exception", servConn.getName(), ce);
+ logger.debug("{}: Unexpected Exception", serverConnection.getName(), ce);
}
return;
} finally {
@@ -264,18 +264,18 @@ public class Put61 extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
} else {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
} else {
- writeReply(msg, servConn);
+ writeReply(clientMessage, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (isDebugEnabled) {
logger.debug("{}: Sent 6.1 put response back to {} for region {} key {} value {}",
- servConn.getName(), servConn.getSocketString(), regionName, key, valuePart);
+ serverConnection.getName(), serverConnection.getSocketString(), regionName, key, valuePart);
}
stats.incWritePutResponseTime(DistributionStats.getStatTime() - start);
}
[20/28] geode git commit: Cleanup BaseCommand
Posted by kl...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest.java
index 52a929f..afb0f2c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest.java
@@ -46,51 +46,51 @@ public class RegisterInterest extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null;
String regionName = null;
Object key = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
InterestResultPolicy policy = null;
// Retrieve the interest type
- int interestType = msg.getPart(1).getInt();
+ int interestType = clientMessage.getPart(1).getInt();
// Retrieve the InterestResultPolicy
try {
- policy = (InterestResultPolicy) msg.getPart(2).getObject();
+ policy = (InterestResultPolicy) clientMessage.getPart(2).getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isDurable = false;
try {
- Part durablePart = msg.getPart(3);
+ Part durablePart = clientMessage.getPart(3);
byte[] durablePartBytes = (byte[]) durablePart.getObject();
isDurable = durablePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Retrieve the key
- keyPart = msg.getPart(4);
+ keyPart = clientMessage.getPart(4);
regionName = regionNamePart.getString();
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -98,21 +98,21 @@ public class RegisterInterest extends BaseCommand {
// VJR: Check for a sixth part for client version 6.0.3 onwards for the
// time being until refactoring into a new command version.
- if (msg.getNumberOfParts() > 5) {
+ if (clientMessage.getNumberOfParts() > 5) {
try {
- Part notifyPart = msg.getPart(5);
+ Part notifyPart = clientMessage.getPart(5);
byte[] notifyPartBytes = (byte[]) notifyPart.getObject();
sendUpdatesAsInvalidates = notifyPartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received register interest request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// Process the register interest request
@@ -126,19 +126,19 @@ public class RegisterInterest extends BaseCommand {
message =
LocalizedStrings.RegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_REGISTER_INTEREST_REQUEST_IS_NULL;
}
- logger.warn("{}: {}", servConn.getName(), message.toLocalizedString());
- writeChunkedErrorResponse(msg, MessageType.REGISTER_INTEREST_DATA_ERROR,
- message.toLocalizedString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), message.toLocalizedString());
+ writeChunkedErrorResponse(clientMessage, MessageType.REGISTER_INTEREST_DATA_ERROR,
+ message.toLocalizedString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// input key not null
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
logger.info(LocalizedMessage.create(
LocalizedStrings.RegisterInterest_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_REQUEST,
- new Object[] {servConn.getName(), regionName}));
+ new Object[] { serverConnection.getName(), regionName}));
// writeChunkedErrorResponse(msg,
// MessageType.REGISTER_INTEREST_DATA_ERROR, message);
// responded = true;
@@ -151,7 +151,7 @@ public class RegisterInterest extends BaseCommand {
this.securityService.authorizeRegionRead(regionName, key.toString());
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegisterInterestOperationContext registerContext =
@@ -159,14 +159,14 @@ public class RegisterInterest extends BaseCommand {
key = registerContext.getKey();
}
}
- servConn.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, key,
- servConn.getProxyID(), interestType, isDurable, sendUpdatesAsInvalidates, false, 0, true);
+ serverConnection.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, key,
+ serverConnection.getProxyID(), interestType, isDurable, sendUpdatesAsInvalidates, false, 0, true);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -178,45 +178,45 @@ public class RegisterInterest extends BaseCommand {
// start = DistributionStats.getStatTime();
CacheClientProxy ccp =
- servConn.getAcceptor().getCacheClientNotifier().getClientProxy(servConn.getProxyID());
+ serverConnection.getAcceptor().getCacheClientNotifier().getClientProxy(serverConnection.getProxyID());
if (ccp == null) {
// fix for 37593
IOException ioex = new IOException(
LocalizedStrings.RegisterInterest_CACHECLIENTPROXY_FOR_THIS_CLIENT_IS_NO_LONGER_ON_THE_SERVER_SO_REGISTERINTEREST_OPERATION_IS_UNSUCCESSFUL
.toLocalizedString());
- writeChunkedException(msg, ioex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ioex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isPrimary = ccp.isPrimary();
- ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getRegisterInterestResponseMessage();
if (!isPrimary) {
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_SECONDARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
chunkedResponseMsg.setLastChunk(true);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sending register interest response chunk from secondary for region: {} for key: {} chunk=<{}>",
- servConn.getName(), regionName, key, chunkedResponseMsg);
+ serverConnection.getName(), regionName, key, chunkedResponseMsg);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
} // !isPrimary
else { // isPrimary
// Send header which describes how many chunks will follow
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_PRIMARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendRegisterInterestResponseChunks(region, key, interestType, policy, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendRegisterInterestResponseChunks(region, key, interestType, policy, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn, chunkedResponseMsg);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection, chunkedResponseMsg);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -224,7 +224,7 @@ public class RegisterInterest extends BaseCommand {
// logger.debug(getName() + ": Sent chunk (1 of 1) of register interest
// response (" + chunkedResponseMsg.getBufferLength() + " bytes) for
// region " + regionName + " key " + key);
- logger.debug("{}: Sent register interest response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent register interest response for region {} key {}", serverConnection.getName(),
regionName, key);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest61.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest61.java
index 5ddb241..af423ca 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest61.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterest61.java
@@ -60,67 +60,67 @@ public class RegisterInterest61 extends BaseCommand {
RegisterInterest61() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null;
String regionName = null;
Object key = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
InterestResultPolicy policy = null;
// Retrieve the interest type
- int interestType = msg.getPart(1).getInt();
+ int interestType = clientMessage.getPart(1).getInt();
// Retrieve the InterestResultPolicy
try {
- policy = (InterestResultPolicy) msg.getPart(2).getObject();
+ policy = (InterestResultPolicy) clientMessage.getPart(2).getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isDurable = false;
try {
- Part durablePart = msg.getPart(3);
+ Part durablePart = clientMessage.getPart(3);
byte[] durablePartBytes = (byte[]) durablePart.getObject();
isDurable = durablePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// region data policy
byte[] regionDataPolicyPartBytes;
boolean serializeValues = false;
try {
- Part regionDataPolicyPart = msg.getPart(msg.getNumberOfParts() - 1);
+ Part regionDataPolicyPart = clientMessage.getPart(clientMessage.getNumberOfParts() - 1);
regionDataPolicyPartBytes = (byte[]) regionDataPolicyPart.getObject();
- if (servConn.getClientVersion().compareTo(Version.GFE_80) >= 0) {
+ if (serverConnection.getClientVersion().compareTo(Version.GFE_80) >= 0) {
// The second byte here is serializeValues
serializeValues = regionDataPolicyPartBytes[1] == (byte) 0x01;
}
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// Retrieve the key
- keyPart = msg.getPart(4);
+ keyPart = clientMessage.getPart(4);
regionName = regionNamePart.getString();
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -128,14 +128,14 @@ public class RegisterInterest61 extends BaseCommand {
// VJR: Check for a sixth part for client version 6.0.3 onwards for the
// time being until refactoring into a new command version.
- if (msg.getNumberOfParts() > 5) {
+ if (clientMessage.getNumberOfParts() > 5) {
try {
- Part notifyPart = msg.getPart(5);
+ Part notifyPart = clientMessage.getPart(5);
byte[] notifyPartBytes = (byte[]) notifyPart.getObject();
sendUpdatesAsInvalidates = notifyPartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -143,7 +143,7 @@ public class RegisterInterest61 extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received register interest 61 request ({} bytes) from {} for region {} key {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key);
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key);
}
// test hook to trigger vMotion during register Interest
@@ -164,19 +164,19 @@ public class RegisterInterest61 extends BaseCommand {
message =
LocalizedStrings.RegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_REGISTER_INTEREST_REQUEST_IS_NULL;
}
- logger.warn("{}: {}", servConn.getName(), message.toLocalizedString());
- writeChunkedErrorResponse(msg, MessageType.REGISTER_INTEREST_DATA_ERROR,
- message.toLocalizedString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), message.toLocalizedString());
+ writeChunkedErrorResponse(clientMessage, MessageType.REGISTER_INTEREST_DATA_ERROR,
+ message.toLocalizedString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// input key not null
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
logger.info(LocalizedMessage.create(
LocalizedStrings.RegisterInterest_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_REQUEST,
- new Object[] {servConn.getName(), regionName}));
+ new Object[] { serverConnection.getName(), regionName}));
// writeChunkedErrorResponse(msg,
// MessageType.REGISTER_INTEREST_DATA_ERROR, message);
// responded = true;
@@ -190,7 +190,7 @@ public class RegisterInterest61 extends BaseCommand {
this.securityService.authorizeRegionRead(regionName, key.toString());
}
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegisterInterestOperationContext registerContext =
@@ -198,15 +198,15 @@ public class RegisterInterest61 extends BaseCommand {
key = registerContext.getKey();
}
}
- servConn.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, key,
- servConn.getProxyID(), interestType, isDurable, sendUpdatesAsInvalidates, true,
+ serverConnection.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, key,
+ serverConnection.getProxyID(), interestType, isDurable, sendUpdatesAsInvalidates, true,
regionDataPolicyPartBytes[0], true);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -218,46 +218,46 @@ public class RegisterInterest61 extends BaseCommand {
// start = DistributionStats.getStatTime();
CacheClientProxy ccp =
- servConn.getAcceptor().getCacheClientNotifier().getClientProxy(servConn.getProxyID());
+ serverConnection.getAcceptor().getCacheClientNotifier().getClientProxy(serverConnection.getProxyID());
if (ccp == null) {
// fix for 37593
IOException ioex = new IOException(
LocalizedStrings.RegisterInterest_CACHECLIENTPROXY_FOR_THIS_CLIENT_IS_NO_LONGER_ON_THE_SERVER_SO_REGISTERINTEREST_OPERATION_IS_UNSUCCESSFUL
.toLocalizedString());
- writeChunkedException(msg, ioex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ioex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isPrimary = ccp.isPrimary();
- ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
+ ChunkedMessage chunkedResponseMsg = serverConnection.getRegisterInterestResponseMessage();
if (!isPrimary) {
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_SECONDARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
chunkedResponseMsg.setLastChunk(true);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sending register interest response chunk from secondary for region: {} for key: {} chunk=<{}>",
- servConn.getName(), regionName, key, chunkedResponseMsg);
+ serverConnection.getName(), regionName, key, chunkedResponseMsg);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
} // !isPrimary
else { // isPrimary
// Send header which describes how many chunks will follow
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_PRIMARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
fillAndSendRegisterInterestResponseChunks(region, key, interestType, serializeValues,
- policy, servConn);
- servConn.setAsTrue(RESPONDED);
+ policy, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn, chunkedResponseMsg);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection, chunkedResponseMsg);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -265,7 +265,7 @@ public class RegisterInterest61 extends BaseCommand {
// logger.debug(getName() + ": Sent chunk (1 of 1) of register interest
// response (" + chunkedResponseMsg.getBufferLength() + " bytes) for
// region " + regionName + " key " + key);
- logger.debug("{}: Sent register interest response for region {} key {}", servConn.getName(),
+ logger.debug("{}: Sent register interest response for region {} key {}", serverConnection.getName(),
regionName, key);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList.java
index cd16790..4206e19 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList.java
@@ -49,57 +49,57 @@ public class RegisterInterestList extends BaseCommand {
RegisterInterestList() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null, numberOfKeysPart = null;
String regionName = null;
Object key = null;
InterestResultPolicy policy;
List keys = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
int numberOfKeys = 0, partNumber = 0;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
- ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ ChunkedMessage chunkedResponseMsg = serverConnection.getRegisterInterestResponseMessage();
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
// Retrieve the InterestResultPolicy
try {
- policy = (InterestResultPolicy) msg.getPart(1).getObject();
+ policy = (InterestResultPolicy) clientMessage.getPart(1).getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isDurable = false;
try {
- Part durablePart = msg.getPart(2);
+ Part durablePart = clientMessage.getPart(2);
byte[] durablePartBytes = (byte[]) durablePart.getObject();
isDurable = durablePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- numberOfKeysPart = msg.getPart(3);
+ numberOfKeysPart = clientMessage.getPart(3);
numberOfKeys = numberOfKeysPart.getInt();
partNumber = 4;
keys = new ArrayList();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(partNumber + i);
+ keyPart = clientMessage.getPart(partNumber + i);
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
keys.add(key);
@@ -109,14 +109,14 @@ public class RegisterInterestList extends BaseCommand {
// VJR: Check for an extra part for client version 6.0.3 onwards for the
// time being until refactoring into a new command version.
- if (msg.getNumberOfParts() > (numberOfKeys + partNumber)) {
+ if (clientMessage.getNumberOfParts() > (numberOfKeys + partNumber)) {
try {
- Part notifyPart = msg.getPart(numberOfKeys + partNumber);
+ Part notifyPart = clientMessage.getPart(numberOfKeys + partNumber);
byte[] notifyPartBytes = (byte[]) notifyPart.getObject();
sendUpdatesAsInvalidates = notifyPartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -124,7 +124,7 @@ public class RegisterInterestList extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received register interest request ({} bytes) from {} for the following {} keys in region {}: {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), numberOfKeys,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), numberOfKeys,
regionName, keys);
}
@@ -154,25 +154,25 @@ public class RegisterInterestList extends BaseCommand {
LocalizedStrings.RegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_REGISTER_INTEREST_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeChunkedErrorResponse(msg, MessageType.REGISTER_INTEREST_DATA_ERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeChunkedErrorResponse(clientMessage, MessageType.REGISTER_INTEREST_DATA_ERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// key not null
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
logger.info(LocalizedMessage.create(
LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST,
- new Object[] {servConn.getName(), regionName}));
+ new Object[] { serverConnection.getName(), regionName}));
// writeChunkedErrorResponse(msg,
// MessageType.REGISTER_INTEREST_DATA_ERROR, message);
// responded = true;
} // else { // region not null
try {
this.securityService.authorizeRegionRead(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegisterInterestOperationContext registerContext =
@@ -181,14 +181,14 @@ public class RegisterInterestList extends BaseCommand {
}
}
// Register interest
- servConn.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
- servConn.getProxyID(), isDurable, sendUpdatesAsInvalidates, false, 0, true);
+ serverConnection.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
+ serverConnection.getProxyID(), isDurable, sendUpdatesAsInvalidates, false, 0, true);
} catch (Exception ex) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ex);
+ checkForInterrupt(serverConnection, ex);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -197,36 +197,36 @@ public class RegisterInterestList extends BaseCommand {
// DistributionStats.getStatTime() - start);
// start = DistributionStats.getStatTime();
- boolean isPrimary = servConn.getAcceptor().getCacheClientNotifier()
- .getClientProxy(servConn.getProxyID()).isPrimary();
+ boolean isPrimary = serverConnection.getAcceptor().getCacheClientNotifier()
+ .getClientProxy(serverConnection.getProxyID()).isPrimary();
if (!isPrimary) {
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_SECONDARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
chunkedResponseMsg.setLastChunk(true);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sending register interest response chunk from secondary for region: {} for key: {} chunk=<{}>",
- servConn.getName(), regionName, key, chunkedResponseMsg);
+ serverConnection.getName(), regionName, key, chunkedResponseMsg);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
} else { // isPrimary
// Send header which describes how many chunks will follow
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_PRIMARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendRegisterInterestResponseChunks(region, keys, InterestType.KEY, policy, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendRegisterInterestResponseChunks(region, keys, InterestType.KEY, policy, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// otherwise send the exception back to client
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -236,7 +236,7 @@ public class RegisterInterestList extends BaseCommand {
// region " + regionName + " key " + key);
logger.debug(
"{}: Sent register interest response for the following {} keys in region {}: {}",
- servConn.getName(), numberOfKeys, regionName, keys);
+ serverConnection.getName(), numberOfKeys, regionName, keys);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
// DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList61.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList61.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList61.java
index 6e006ca..8eb6c4a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList61.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList61.java
@@ -49,67 +49,67 @@ public class RegisterInterestList61 extends BaseCommand {
RegisterInterestList61() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null, numberOfKeysPart = null;
String regionName = null;
Object key = null;
InterestResultPolicy policy;
List keys = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
int numberOfKeys = 0, partNumber = 0;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
- ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ ChunkedMessage chunkedResponseMsg = serverConnection.getRegisterInterestResponseMessage();
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
// Retrieve the InterestResultPolicy
try {
- policy = (InterestResultPolicy) msg.getPart(1).getObject();
+ policy = (InterestResultPolicy) clientMessage.getPart(1).getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isDurable = false;
try {
- Part durablePart = msg.getPart(2);
+ Part durablePart = clientMessage.getPart(2);
byte[] durablePartBytes = (byte[]) durablePart.getObject();
isDurable = durablePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// region data policy
byte[] regionDataPolicyPartBytes;
try {
- Part regionDataPolicyPart = msg.getPart(msg.getNumberOfParts() - 1);
+ Part regionDataPolicyPart = clientMessage.getPart(clientMessage.getNumberOfParts() - 1);
regionDataPolicyPartBytes = (byte[]) regionDataPolicyPart.getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- numberOfKeysPart = msg.getPart(3);
+ numberOfKeysPart = clientMessage.getPart(3);
numberOfKeys = numberOfKeysPart.getInt();
partNumber = 4;
keys = new ArrayList();
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(partNumber + i);
+ keyPart = clientMessage.getPart(partNumber + i);
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
keys.add(key);
@@ -119,14 +119,14 @@ public class RegisterInterestList61 extends BaseCommand {
// VJR: Check for an extra part for client version 6.0.3 onwards for the
// time being until refactoring into a new command version.
- if (msg.getNumberOfParts() > (numberOfKeys + partNumber)) {
+ if (clientMessage.getNumberOfParts() > (numberOfKeys + partNumber)) {
try {
- Part notifyPart = msg.getPart(numberOfKeys + partNumber);
+ Part notifyPart = clientMessage.getPart(numberOfKeys + partNumber);
byte[] notifyPartBytes = (byte[]) notifyPart.getObject();
sendUpdatesAsInvalidates = notifyPartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -134,7 +134,7 @@ public class RegisterInterestList61 extends BaseCommand {
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received register interest 61 request ({} bytes) from {} for the following {} keys in region {}: {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), numberOfKeys,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), numberOfKeys,
regionName, keys);
}
@@ -164,25 +164,25 @@ public class RegisterInterestList61 extends BaseCommand {
LocalizedStrings.RegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_REGISTER_INTEREST_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeChunkedErrorResponse(msg, MessageType.REGISTER_INTEREST_DATA_ERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeChunkedErrorResponse(clientMessage, MessageType.REGISTER_INTEREST_DATA_ERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
logger.info(LocalizedMessage.create(
LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST,
- new Object[] {servConn.getName(), regionName}));
+ new Object[] { serverConnection.getName(), regionName}));
// writeChunkedErrorResponse(msg,
// MessageType.REGISTER_INTEREST_DATA_ERROR, message);
// responded = true;
} // else { // region not null
try {
this.securityService.authorizeRegionRead(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegisterInterestOperationContext registerContext =
@@ -191,15 +191,15 @@ public class RegisterInterestList61 extends BaseCommand {
}
}
// Register interest
- servConn.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
- servConn.getProxyID(), isDurable, sendUpdatesAsInvalidates, true,
+ serverConnection.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
+ serverConnection.getProxyID(), isDurable, sendUpdatesAsInvalidates, true,
regionDataPolicyPartBytes[0], true);
} catch (Exception ex) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ex);
+ checkForInterrupt(serverConnection, ex);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -208,36 +208,36 @@ public class RegisterInterestList61 extends BaseCommand {
// DistributionStats.getStatTime() - start);
// start = DistributionStats.getStatTime();
- boolean isPrimary = servConn.getAcceptor().getCacheClientNotifier()
- .getClientProxy(servConn.getProxyID()).isPrimary();
+ boolean isPrimary = serverConnection.getAcceptor().getCacheClientNotifier()
+ .getClientProxy(serverConnection.getProxyID()).isPrimary();
if (!isPrimary) {
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_SECONDARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
chunkedResponseMsg.setLastChunk(true);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sending register interest response chunk from secondary for region: {} for key: {} chunk=<{}>",
- servConn.getName(), regionName, key, chunkedResponseMsg);
+ serverConnection.getName(), regionName, key, chunkedResponseMsg);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
} else { // isPrimary
// Send header which describes how many chunks will follow
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_PRIMARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
- fillAndSendRegisterInterestResponseChunks(region, keys, InterestType.KEY, policy, servConn);
- servConn.setAsTrue(RESPONDED);
+ fillAndSendRegisterInterestResponseChunks(region, keys, InterestType.KEY, policy, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// otherwise send the exception back to client
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -247,7 +247,7 @@ public class RegisterInterestList61 extends BaseCommand {
// region " + regionName + " key " + key);
logger.debug(
"{}: Sent register interest response for the following {} keys in region {}: {}",
- servConn.getName(), numberOfKeys, regionName, keys);
+ serverConnection.getName(), numberOfKeys, regionName, keys);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
// DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList66.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList66.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList66.java
index 8a61364..14198cc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList66.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RegisterInterestList66.java
@@ -55,87 +55,87 @@ public class RegisterInterestList66 extends BaseCommand {
RegisterInterestList66() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, InterruptedException {
Part regionNamePart = null, keyPart = null;// numberOfKeysPart = null;
String regionName = null;
Object key = null;
InterestResultPolicy policy;
List keys = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
int numberOfKeys = 0, partNumber = 0;
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
- ChunkedMessage chunkedResponseMsg = servConn.getRegisterInterestResponseMessage();
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ ChunkedMessage chunkedResponseMsg = serverConnection.getRegisterInterestResponseMessage();
// bserverStats.incLong(readDestroyRequestTimeId,
// DistributionStats.getStatTime() - start);
// bserverStats.incInt(destroyRequestsId, 1);
// start = DistributionStats.getStatTime();
// Retrieve the data from the message parts
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
// Retrieve the InterestResultPolicy
try {
- policy = (InterestResultPolicy) msg.getPart(1).getObject();
+ policy = (InterestResultPolicy) clientMessage.getPart(1).getObject();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean isDurable = false;
try {
- Part durablePart = msg.getPart(2);
+ Part durablePart = clientMessage.getPart(2);
byte[] durablePartBytes = (byte[]) durablePart.getObject();
isDurable = durablePartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// region data policy
byte[] regionDataPolicyPartBytes;
boolean serializeValues = false;
try {
- Part regionDataPolicyPart = msg.getPart(msg.getNumberOfParts() - 1);
+ Part regionDataPolicyPart = clientMessage.getPart(clientMessage.getNumberOfParts() - 1);
regionDataPolicyPartBytes = (byte[]) regionDataPolicyPart.getObject();
- if (servConn.getClientVersion().compareTo(Version.GFE_80) >= 0) {
+ if (serverConnection.getClientVersion().compareTo(Version.GFE_80) >= 0) {
// The second byte here is serializeValues
serializeValues = regionDataPolicyPartBytes[1] == (byte) 0x01;
}
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
partNumber = 3;
- Part list = msg.getPart(partNumber);
+ Part list = clientMessage.getPart(partNumber);
try {
keys = (List) list.getObject();
numberOfKeys = keys.size();
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
boolean sendUpdatesAsInvalidates = false;
try {
- Part notifyPart = msg.getPart(partNumber + 1);
+ Part notifyPart = clientMessage.getPart(partNumber + 1);
byte[] notifyPartBytes = (byte[]) notifyPart.getObject();
sendUpdatesAsInvalidates = notifyPartBytes[0] == 0x01;
} catch (Exception e) {
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Received register interest 66 request ({} bytes) from {} for the following {} keys in region {}: {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), numberOfKeys,
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), numberOfKeys,
regionName, keys);
}
@@ -165,24 +165,24 @@ public class RegisterInterestList66 extends BaseCommand {
LocalizedStrings.RegisterInterest_THE_INPUT_REGION_NAME_FOR_THE_REGISTER_INTEREST_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeChunkedErrorResponse(msg, MessageType.REGISTER_INTEREST_DATA_ERROR, s, servConn);
- servConn.setAsTrue(RESPONDED);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeChunkedErrorResponse(clientMessage, MessageType.REGISTER_INTEREST_DATA_ERROR, s, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
}
// key not null
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
logger.info(LocalizedMessage.create(
LocalizedStrings.RegisterInterestList_0_REGION_NAMED_1_WAS_NOT_FOUND_DURING_REGISTER_INTEREST_LIST_REQUEST,
- new Object[] {servConn.getName(), regionName}));
+ new Object[] { serverConnection.getName(), regionName}));
// writeChunkedErrorResponse(msg,
// MessageType.REGISTER_INTEREST_DATA_ERROR, message);
// responded = true;
} // else { // region not null
try {
this.securityService.authorizeRegionRead(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (!DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
RegisterInterestOperationContext registerContext =
@@ -191,15 +191,15 @@ public class RegisterInterestList66 extends BaseCommand {
}
}
// Register interest
- servConn.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
- servConn.getProxyID(), isDurable, sendUpdatesAsInvalidates, true,
+ serverConnection.getAcceptor().getCacheClientNotifier().registerClientInterest(regionName, keys,
+ serverConnection.getProxyID(), isDurable, sendUpdatesAsInvalidates, true,
regionDataPolicyPartBytes[0], true);
} catch (Exception ex) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ex);
+ checkForInterrupt(serverConnection, ex);
// Otherwise, write an exception message and continue
- writeChunkedException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ex, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -208,37 +208,37 @@ public class RegisterInterestList66 extends BaseCommand {
// DistributionStats.getStatTime() - start);
// start = DistributionStats.getStatTime();
- boolean isPrimary = servConn.getAcceptor().getCacheClientNotifier()
- .getClientProxy(servConn.getProxyID()).isPrimary();
+ boolean isPrimary = serverConnection.getAcceptor().getCacheClientNotifier()
+ .getClientProxy(serverConnection.getProxyID()).isPrimary();
if (!isPrimary) {
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_SECONDARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
chunkedResponseMsg.setLastChunk(true);
if (logger.isDebugEnabled()) {
logger.debug(
"{}: Sending register interest response chunk from secondary for region: {} for key: {} chunk=<{}>",
- servConn.getName(), regionName, key, chunkedResponseMsg);
+ serverConnection.getName(), regionName, key, chunkedResponseMsg);
}
- chunkedResponseMsg.sendChunk(servConn);
+ chunkedResponseMsg.sendChunk(serverConnection);
} else { // isPrimary
// Send header which describes how many chunks will follow
chunkedResponseMsg.setMessageType(MessageType.RESPONSE_FROM_PRIMARY);
- chunkedResponseMsg.setTransactionId(msg.getTransactionId());
+ chunkedResponseMsg.setTransactionId(clientMessage.getTransactionId());
chunkedResponseMsg.sendHeader();
// Send chunk response
try {
fillAndSendRegisterInterestResponseChunks(region, keys, InterestType.KEY, serializeValues,
- policy, servConn);
- servConn.setAsTrue(RESPONDED);
+ policy, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} catch (Exception e) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, e);
+ checkForInterrupt(serverConnection, e);
// otherwise send the exception back to client
- writeChunkedException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, e, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -248,7 +248,7 @@ public class RegisterInterestList66 extends BaseCommand {
// region " + regionName + " key " + key);
logger.debug(
"{}: Sent register interest response for the following {} keys in region {}: {}",
- servConn.getName(), numberOfKeys, regionName, keys);
+ serverConnection.getName(), numberOfKeys, regionName, keys);
}
// bserverStats.incLong(writeDestroyResponseTimeId,
// DistributionStats.getStatTime() - start);
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAll.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAll.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAll.java
index 88386a1..52a1df3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAll.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveAll.java
@@ -61,7 +61,7 @@ public class RemoveAll extends BaseCommand {
protected RemoveAll() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long startp)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long startp)
throws IOException, InterruptedException {
long start = startp; // copy this since we need to modify it
Part regionNamePart = null, numberOfKeysPart = null, keyPart = null;
@@ -73,11 +73,11 @@ public class RemoveAll extends BaseCommand {
VersionedObjectList response = null;
StringBuffer errMessage = new StringBuffer();
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
- servConn.setAsTrue(REQUIRES_RESPONSE);
- servConn.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
{
long oldStart = start;
start = DistributionStats.getStatTime();
@@ -87,7 +87,7 @@ public class RemoveAll extends BaseCommand {
try {
// Retrieve the data from the message parts
// part 0: region name
- regionNamePart = msg.getPart(0);
+ regionNamePart = clientMessage.getPart(0);
regionName = regionNamePart.getString();
if (regionName == null) {
@@ -95,67 +95,66 @@ public class RemoveAll extends BaseCommand {
LocalizedStrings.RemoveAll_THE_INPUT_REGION_NAME_FOR_THE_REMOVEALL_REQUEST_IS_NULL
.toLocalizedString();
logger.warn(LocalizedMessage.create(LocalizedStrings.TWO_ARG_COLON,
- new Object[] {servConn.getName(), txt}));
+ new Object[] { serverConnection.getName(), txt}));
errMessage.append(txt);
- writeChunkedErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- LocalRegion region = (LocalRegion) servConn.getCache().getRegion(regionName);
+ LocalRegion region = (LocalRegion) serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = " was not found during removeAll request";
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
// part 1: eventID
- eventPart = msg.getPart(1);
+ eventPart = clientMessage.getPart(1);
ByteBuffer eventIdPartsBuffer = ByteBuffer.wrap(eventPart.getSerializedForm());
long threadId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
long sequenceId = EventID.readEventIdPartsFromOptmizedByteArray(eventIdPartsBuffer);
- EventID eventId = new EventID(servConn.getEventMemberIDByteArray(), threadId, sequenceId);
+ EventID eventId = new EventID(serverConnection.getEventMemberIDByteArray(), threadId, sequenceId);
Breadcrumbs.setEventId(eventId);
// part 2: flags
- int flags = msg.getPart(2).getInt();
+ int flags = clientMessage.getPart(2).getInt();
boolean clientIsEmpty = (flags & PutAllOp.FLAG_EMPTY) != 0;
boolean clientHasCCEnabled = (flags & PutAllOp.FLAG_CONCURRENCY_CHECKS) != 0;
// part 3: callbackArg
- Object callbackArg = msg.getPart(3).getObject();
+ Object callbackArg = clientMessage.getPart(3).getObject();
// part 4: number of keys
- numberOfKeysPart = msg.getPart(4);
+ numberOfKeysPart = clientMessage.getPart(4);
numberOfKeys = numberOfKeysPart.getInt();
if (logger.isDebugEnabled()) {
StringBuilder buffer = new StringBuilder();
- buffer.append(servConn.getName()).append(": Received removeAll request from ")
- .append(servConn.getSocketString()).append(" for region ").append(regionName)
- .append(callbackArg != null ? (" callbackArg " + callbackArg) : "").append(" with ")
- .append(numberOfKeys).append(" keys.");
+ buffer.append(serverConnection.getName()).append(": Received removeAll request from ")
+ .append(serverConnection.getSocketString()).append(" for region ").append(regionName)
+ .append(callbackArg != null ? (" callbackArg " + callbackArg) : "").append(" with ")
+ .append(numberOfKeys).append(" keys.");
logger.debug(buffer);
}
ArrayList<Object> keys = new ArrayList<Object>(numberOfKeys);
ArrayList<VersionTag> retryVersions = new ArrayList<VersionTag>(numberOfKeys);
for (int i = 0; i < numberOfKeys; i++) {
- keyPart = msg.getPart(5 + i);
+ keyPart = clientMessage.getPart(5 + i);
key = keyPart.getStringOrObject();
if (key == null) {
String txt =
LocalizedStrings.RemoveAll_ONE_OF_THE_INPUT_KEYS_FOR_THE_REMOVEALL_REQUEST_IS_NULL
.toLocalizedString();
logger.warn(LocalizedMessage.create(LocalizedStrings.TWO_ARG_COLON,
- new Object[] {servConn.getName(), txt}));
+ new Object[] { serverConnection.getName(), txt}));
errMessage.append(txt);
- writeChunkedErrorResponse(msg, MessageType.PUT_DATA_ERROR, errMessage.toString(),
- servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedErrorResponse(clientMessage, MessageType.PUT_DATA_ERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
- if (msg.isRetry()) {
+ if (clientMessage.isRetry()) {
// Constuct the thread id/sequence id information for this element of the bulk op
// The sequence id is constructed from the base sequence id and the offset
@@ -181,15 +180,15 @@ public class RemoveAll extends BaseCommand {
keys.add(key);
} // for
- if (msg.getNumberOfParts() == (5 + numberOfKeys + 1)) {// it means optional timeout has been
+ if (clientMessage.getNumberOfParts() == (5 + numberOfKeys + 1)) {// it means optional timeout has been
// added
- int timeout = msg.getPart(5 + numberOfKeys).getInt();
- servConn.setRequestSpecificTimeout(timeout);
+ int timeout = clientMessage.getPart(5 + numberOfKeys).getInt();
+ serverConnection.setRequestSpecificTimeout(timeout);
}
this.securityService.authorizeRegionWrite(regionName);
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
authzRequest.createRegionAuthorize(regionName);
@@ -200,7 +199,7 @@ public class RemoveAll extends BaseCommand {
}
}
- response = region.basicBridgeRemoveAll(keys, retryVersions, servConn.getProxyID(), eventId,
+ response = region.basicBridgeRemoveAll(keys, retryVersions, serverConnection.getProxyID(), eventId,
callbackArg);
if (!region.getConcurrencyChecksEnabled() || clientIsEmpty || !clientHasCCEnabled) {
// the client only needs this if versioning is being used and the client
@@ -216,33 +215,33 @@ public class RemoveAll extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeReplyWithRefreshMetadata(msg, response, servConn, pr, pr.getNetworkHopType());
+ writeReplyWithRefreshMetadata(clientMessage, response, serverConnection, pr, pr.getNetworkHopType());
pr.clearNetworkHopData();
replyWithMetaData = true;
}
}
} catch (RegionDestroyedException rde) {
- writeChunkedException(msg, rde, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, rde, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (ResourceException re) {
- writeChunkedException(msg, re, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, re, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (PutAllPartialResultException pre) {
- writeChunkedException(msg, pre, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, pre, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} catch (Exception ce) {
// If an interrupted exception is thrown , rethrow it
- checkForInterrupt(servConn, ce);
+ checkForInterrupt(serverConnection, ce);
// If an exception occurs during the op, preserve the connection
- writeChunkedException(msg, ce, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeChunkedException(clientMessage, ce, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
// if (logger.fineEnabled()) {
logger.warn(LocalizedMessage.create(LocalizedStrings.Generic_0_UNEXPECTED_EXCEPTION,
- servConn.getName()), ce);
+ serverConnection.getName()), ce);
// }
return;
} finally {
@@ -251,20 +250,20 @@ public class RemoveAll extends BaseCommand {
stats.incProcessRemoveAllTime(start - oldStart);
}
if (logger.isDebugEnabled()) {
- logger.debug("{}: Sending removeAll response back to {} for region {}{}", servConn.getName(),
- servConn.getSocketString(), regionName, (logger.isTraceEnabled() ? ": " + response : ""));
+ logger.debug("{}: Sending removeAll response back to {} for region {}{}", serverConnection.getName(),
+ serverConnection.getSocketString(), regionName, (logger.isTraceEnabled() ? ": " + response : ""));
}
// Increment statistics and write the reply
if (!replyWithMetaData) {
- writeReply(msg, response, servConn);
+ writeReply(clientMessage, response, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
stats.incWriteRemoveAllResponseTime(DistributionStats.getStatTime() - start);
}
@Override
- protected void writeReply(Message origMsg, ServerConnection servConn) throws IOException {
+ protected void writeReply(Message origMsg, ServerConnection serverConnection) throws IOException {
throw new UnsupportedOperationException();
}
@@ -285,7 +284,7 @@ public class RemoveAll extends BaseCommand {
}
replyMsg.sendHeader();
if (listSize > 0) {
- int chunkSize = 2 * maximumChunkSize;
+ int chunkSize = 2 * MAXIMUM_CHUNK_SIZE;
// Chunker will stream over the list in its toData method
VersionedObjectList.Chunker chunk =
new VersionedObjectList.Chunker(response, chunkSize, false, false);
@@ -317,7 +316,7 @@ public class RemoveAll extends BaseCommand {
}
@Override
- protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection servConn,
+ protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection,
PartitionedRegion pr, byte nwHop) throws IOException {
throw new UnsupportedOperationException();
}
@@ -345,7 +344,7 @@ public class RemoveAll extends BaseCommand {
replyMsg.setLastChunk(false);
replyMsg.sendChunk(servConn);
- int chunkSize = 2 * maximumChunkSize; // maximumChunkSize
+ int chunkSize = 2 * MAXIMUM_CHUNK_SIZE; // MAXIMUM_CHUNK_SIZE
// Chunker will stream over the list in its toData method
VersionedObjectList.Chunker chunk =
new VersionedObjectList.Chunker(response, chunkSize, false, false);
@@ -371,7 +370,7 @@ public class RemoveAll extends BaseCommand {
}
pr.getPrStats().incPRMetaDataSentCount();
if (logger.isTraceEnabled()) {
- logger.trace("{}: rpl with REFRESH_METADAT tx: {}", servConn.getName(),
+ logger.trace("{}: rpl with REFRESH_METADATA tx: {}", servConn.getName(),
origMsg.getTransactionId());
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveUserAuth.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveUserAuth.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveUserAuth.java
index 42a5bec..16333ac 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveUserAuth.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RemoveUserAuth.java
@@ -33,9 +33,9 @@ public class RemoveUserAuth extends BaseCommand {
}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start)
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start)
throws IOException, ClassNotFoundException, InterruptedException {
- boolean isSecureMode = msg.isSecureMode();
+ boolean isSecureMode = clientMessage.isSecureMode();
if (!isSecureMode) {
// need to throw exception
@@ -43,29 +43,29 @@ public class RemoveUserAuth extends BaseCommand {
}
try {
- servConn.setAsTrue(REQUIRES_RESPONSE);
- Part keepalivePart = msg.getPart(0);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
+ Part keepalivePart = clientMessage.getPart(0);
byte[] keepaliveByte = keepalivePart.getSerializedForm();
boolean keepalive = (keepaliveByte == null || keepaliveByte[0] == 0) ? false : true;
- servConn.getSecurityLogWriter().fine("remove user auth keep alive " + keepalive);
- servConn.removeUserAuth(msg, keepalive);
- writeReply(msg, servConn);
+ serverConnection.getSecurityLogWriter().fine("remove user auth keep alive " + keepalive);
+ serverConnection.removeUserAuth(clientMessage, keepalive);
+ writeReply(clientMessage, serverConnection);
} catch (GemFireSecurityException gfse) {
- if (servConn.getSecurityLogWriter().warningEnabled()) {
- servConn.getSecurityLogWriter().warning(LocalizedStrings.ONE_ARG,
- servConn.getName() + ": Security exception: " + gfse.getMessage());
+ if (serverConnection.getSecurityLogWriter().warningEnabled()) {
+ serverConnection.getSecurityLogWriter().warning(LocalizedStrings.ONE_ARG,
+ serverConnection.getName() + ": Security exception: " + gfse.getMessage());
}
- writeException(msg, gfse, false, servConn);
+ writeException(clientMessage, gfse, false, serverConnection);
} catch (Exception ex) {
// TODO Auto-generated catch block
- if (servConn.getLogWriter().warningEnabled()) {
- servConn.getLogWriter().warning(
+ if (serverConnection.getLogWriter().warningEnabled()) {
+ serverConnection.getLogWriter().warning(
LocalizedStrings.CacheClientNotifier_AN_EXCEPTION_WAS_THROWN_FOR_CLIENT_0_1,
- new Object[] {servConn.getProxyID(), ""}, ex);
+ new Object[] { serverConnection.getProxyID(), ""}, ex);
}
- writeException(msg, ex, false, servConn);
+ writeException(clientMessage, ex, false, serverConnection);
} finally {
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Request.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Request.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Request.java
index f7baba4..964b7a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Request.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Request.java
@@ -52,15 +52,15 @@ public class Request extends BaseCommand {
Request() {}
@Override
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
Part regionNamePart = null, keyPart = null, valuePart = null;
String regionName = null;
Object callbackArg = null, key = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
- CacheServerStats stats = servConn.getCacheServerStats();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
+ CacheServerStats stats = serverConnection.getCacheServerStats();
StringId errMessage = null;
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// requiresResponse = true;
{
long oldStart = start;
@@ -68,18 +68,18 @@ public class Request extends BaseCommand {
stats.incReadGetRequestTime(start - oldStart);
}
// Retrieve the data from the message parts
- int parts = msg.getNumberOfParts();
- regionNamePart = msg.getPart(0);
- keyPart = msg.getPart(1);
+ int parts = clientMessage.getNumberOfParts();
+ regionNamePart = clientMessage.getPart(0);
+ keyPart = clientMessage.getPart(1);
// valuePart = null; (redundant assignment)
if (parts > 2) {
- valuePart = msg.getPart(2);
+ valuePart = clientMessage.getPart(2);
try {
callbackArg = valuePart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
// responded = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
@@ -87,15 +87,15 @@ public class Request extends BaseCommand {
try {
key = keyPart.getStringOrObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
+ writeException(clientMessage, e, false, serverConnection);
// responded = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get request ({} bytes) from {} for region {} key {} txId {}",
- servConn.getName(), msg.getPayloadLength(), servConn.getSocketString(), regionName, key,
- msg.getTransactionId());
+ serverConnection.getName(), clientMessage.getPayloadLength(), serverConnection.getSocketString(), regionName, key,
+ clientMessage.getTransactionId());
}
// Process the get request
@@ -109,31 +109,31 @@ public class Request extends BaseCommand {
errMessage = LocalizedStrings.Request_THE_INPUT_REGION_NAME_FOR_THE_GET_REQUEST_IS_NULL;
}
String s = errMessage.toLocalizedString();
- logger.warn("{}: {}", servConn.getName(), s);
- writeErrorResponse(msg, MessageType.REQUESTDATAERROR, s, servConn);
+ logger.warn("{}: {}", serverConnection.getName(), s);
+ writeErrorResponse(clientMessage, MessageType.REQUESTDATAERROR, s, serverConnection);
// responded = true;
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
} else {
- Region region = servConn.getCache().getRegion(regionName);
+ Region region = serverConnection.getCache().getRegion(regionName);
if (region == null) {
String reason = LocalizedStrings.Request__0_WAS_NOT_FOUND_DURING_GET_REQUEST
.toLocalizedString(regionName);
- writeRegionDestroyedEx(msg, regionName, reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, regionName, reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
GetOperationContext getContext = null;
try {
this.securityService.authorizeRegionRead(regionName, key.toString());
- AuthorizeRequest authzRequest = servConn.getAuthzRequest();
+ AuthorizeRequest authzRequest = serverConnection.getAuthzRequest();
if (authzRequest != null) {
getContext = authzRequest.getAuthorize(regionName, key, callbackArg);
callbackArg = getContext.getCallbackArg();
}
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -141,10 +141,10 @@ public class Request extends BaseCommand {
// the value if it is a byte[].
Object[] valueAndIsObject = new Object[3];
try {
- getValueAndIsObject(region, key, callbackArg, servConn, valueAndIsObject);
+ getValueAndIsObject(region, key, callbackArg, serverConnection, valueAndIsObject);
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
@@ -154,7 +154,7 @@ public class Request extends BaseCommand {
try {
- AuthorizeRequestPP postAuthzRequest = servConn.getPostAuthzRequest();
+ AuthorizeRequestPP postAuthzRequest = serverConnection.getPostAuthzRequest();
if (postAuthzRequest != null) {
getContext = postAuthzRequest.getAuthorize(regionName, key, data, isObject, getContext);
byte[] serializedValue = getContext.getSerializedValue();
@@ -166,8 +166,8 @@ public class Request extends BaseCommand {
isObject = getContext.isObject();
}
} catch (NotAuthorizedException ex) {
- writeException(msg, ex, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, ex, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
{
@@ -179,20 +179,20 @@ public class Request extends BaseCommand {
if (region instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) region;
if (pr.getNetworkHopType() != PartitionedRegion.NETWORK_HOP_NONE) {
- writeResponseWithRefreshMetadata(data, callbackArg, msg, isObject, servConn, pr,
+ writeResponseWithRefreshMetadata(data, callbackArg, clientMessage, isObject, serverConnection, pr,
pr.getNetworkHopType());
pr.clearNetworkHopData();
} else {
- writeResponse(data, callbackArg, msg, isObject, servConn);
+ writeResponse(data, callbackArg, clientMessage, isObject, serverConnection);
}
} else {
- writeResponse(data, callbackArg, msg, isObject, servConn);
+ writeResponse(data, callbackArg, clientMessage, isObject, serverConnection);
}
- servConn.setAsTrue(RESPONDED);
+ serverConnection.setAsTrue(RESPONDED);
if (logger.isDebugEnabled()) {
logger.debug("{}: Wrote get response back to {} for region {} key {} value: {}",
- servConn.getName(), servConn.getSocketString(), regionName, key, data);
+ serverConnection.getName(), serverConnection.getSocketString(), regionName, key, data);
}
stats.incWriteGetResponseTime(DistributionStats.getStatTime() - start);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/db81427f/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RequestEventValue.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RequestEventValue.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RequestEventValue.java
index 3fd84d6..3753ed6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RequestEventValue.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/RequestEventValue.java
@@ -49,57 +49,57 @@ public class RequestEventValue extends BaseCommand {
private RequestEventValue() {}
- public void cmdExecute(Message msg, ServerConnection servConn, long start) throws IOException {
+ public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
Part eventIDPart = null, valuePart = null;
EventID event = null;
Object callbackArg = null;
- CachedRegionHelper crHelper = servConn.getCachedRegionHelper();
+ CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
StringBuffer errMessage = new StringBuffer();
- servConn.setAsTrue(REQUIRES_RESPONSE);
+ serverConnection.setAsTrue(REQUIRES_RESPONSE);
// Retrieve the data from the message parts
- int parts = msg.getNumberOfParts();
- eventIDPart = msg.getPart(0);
+ int parts = clientMessage.getNumberOfParts();
+ eventIDPart = clientMessage.getPart(0);
if (eventIDPart == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.RequestEventValue_0_THE_EVENT_ID_FOR_THE_GET_EVENT_VALUE_REQUEST_IS_NULL,
- servConn.getName()));
+ serverConnection.getName()));
errMessage.append(" The event id for the get event value request is null.");
- writeErrorResponse(msg, MessageType.REQUESTDATAERROR, errMessage.toString(), servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.REQUESTDATAERROR, errMessage.toString(), serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
try {
event = (EventID) eventIDPart.getObject();
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
if (parts > 1) {
- valuePart = msg.getPart(1);
+ valuePart = clientMessage.getPart(1);
try {
if (valuePart != null) {
callbackArg = valuePart.getObject();
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
}
if (logger.isTraceEnabled()) {
- logger.trace("{}: Received get event value request ({} bytes) from {}", servConn.getName(),
- msg.getPayloadLength(), servConn.getSocketString());
+ logger.trace("{}: Received get event value request ({} bytes) from {}", serverConnection.getName(),
+ clientMessage.getPayloadLength(), serverConnection.getSocketString());
}
- CacheClientNotifier ccn = servConn.getAcceptor().getCacheClientNotifier();
+ CacheClientNotifier ccn = serverConnection.getAcceptor().getCacheClientNotifier();
// Get the ha container.
HAContainerWrapper haContainer = (HAContainerWrapper) ccn.getHaContainer();
if (haContainer == null) {
String reason = " was not found during get event value request";
- writeRegionDestroyedEx(msg, "ha container", reason, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeRegionDestroyedEx(clientMessage, "ha container", reason, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
} else {
Object[] valueAndIsObject = new Object[2];
try {
@@ -110,8 +110,8 @@ public class RequestEventValue extends BaseCommand {
LocalizedStrings.RequestEventValue_UNABLE_TO_FIND_A_CLIENT_UPDATE_MESSAGE_FOR_0,
event));
String msgStr = "No value found for " + event + " in " + haContainer.getName();
- writeErrorResponse(msg, MessageType.REQUEST_EVENT_VALUE_ERROR, msgStr, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeErrorResponse(clientMessage, MessageType.REQUEST_EVENT_VALUE_ERROR, msgStr, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
} else {
if (logger.isDebugEnabled()) {
@@ -130,20 +130,20 @@ public class RequestEventValue extends BaseCommand {
valueAndIsObject[1] = Boolean.valueOf(((ClientUpdateMessageImpl) data).valueIsObject());
}
} catch (Exception e) {
- writeException(msg, e, false, servConn);
- servConn.setAsTrue(RESPONDED);
+ writeException(clientMessage, e, false, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
return;
}
Object data = valueAndIsObject[0];
boolean isObject = (Boolean) valueAndIsObject[1];
- writeResponse(data, callbackArg, msg, isObject, servConn);
- servConn.setAsTrue(RESPONDED);
- ccn.getClientProxy(servConn.getProxyID()).getStatistics().incDeltaFullMessagesSent();
+ writeResponse(data, callbackArg, clientMessage, isObject, serverConnection);
+ serverConnection.setAsTrue(RESPONDED);
+ ccn.getClientProxy(serverConnection.getProxyID()).getStatistics().incDeltaFullMessagesSent();
if (logger.isDebugEnabled()) {
logger.debug("{}: Wrote get event value response back to {} for ha container {}",
- servConn.getName(), servConn.getSocketString(), haContainer.getName());
+ serverConnection.getName(), serverConnection.getSocketString(), haContainer.getName());
}
}
}