You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2019/04/30 16:59:58 UTC
[geode] branch develop updated: GEODE-6580: Cleanup static analyzer
warnings. (#3432)
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 3ea508d GEODE-6580: Cleanup static analyzer warnings. (#3432)
3ea508d is described below
commit 3ea508d089598d196f12ecd793521520941f09f8
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Tue Apr 30 09:59:24 2019 -0700
GEODE-6580: Cleanup static analyzer warnings. (#3432)
---
.../geode/cache/client/ClientCacheFactory.java | 50 +--
.../java/org/apache/geode/cache/client/Pool.java | 1 +
.../org/apache/geode/cache/client/PoolFactory.java | 5 +-
.../geode/cache/client/internal/AbstractOp.java | 44 ++-
.../cache/client/internal/AuthenticateUserOp.java | 70 ++--
.../internal/DataSerializerRecoveryListener.java | 12 +-
.../cache/client/internal/ExecutablePool.java | 1 +
.../internal/ExplicitConnectionSourceImpl.java | 3 +-
.../internal/InstantiatorRecoveryListener.java | 9 +-
.../org/apache/geode/cache/client/internal/Op.java | 1 +
.../cache/client/internal/OpExecutorImpl.java | 127 +++-----
.../geode/cache/client/internal/PoolImpl.java | 358 +++++++++------------
.../apache/geode/cache/client/internal/PutOp.java | 155 +++------
.../internal/pooling/ConnectionManagerImpl.java | 203 ++++++------
.../geode/internal/cache/PoolFactoryImpl.java | 233 +++++++-------
.../geode/internal/cache/PoolManagerImpl.java | 89 +++--
.../apache/geode/cache/configuration/PoolType.java | 67 ++--
17 files changed, 616 insertions(+), 812 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
index bf445a0..0581634 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
@@ -155,7 +156,7 @@ public class ClientCacheFactory {
* Creates a new client cache factory.
*/
public ClientCacheFactory() {
- this.dsProps = new Properties();
+ dsProps = new Properties();
}
/**
@@ -169,7 +170,7 @@ public class ClientCacheFactory {
if (props == null) {
props = new Properties();
}
- this.dsProps = props;
+ dsProps = props;
}
/**
@@ -181,7 +182,7 @@ public class ClientCacheFactory {
* @return a reference to this ClientCacheFactory object
*/
public ClientCacheFactory set(String name, String value) {
- this.dsProps.setProperty(name, value);
+ dsProps.setProperty(name, value);
return this;
}
@@ -214,12 +215,17 @@ public class ClientCacheFactory {
return basicCreate();
}
+ @SuppressWarnings("deprecation")
+ private static InternalClientCache getInternalClientCache() {
+ return GemFireCacheImpl.getInstance();
+ }
+
private ClientCache basicCreate() {
synchronized (ClientCacheFactory.class) {
- InternalClientCache instance = GemFireCacheImpl.getInstance();
+ InternalClientCache instance = getInternalClientCache();
{
- String propValue = this.dsProps.getProperty(MCAST_PORT);
+ String propValue = dsProps.getProperty(MCAST_PORT);
if (propValue != null) {
int mcastPort = Integer.parseInt(propValue);
if (mcastPort != 0) {
@@ -230,17 +236,16 @@ public class ClientCacheFactory {
}
}
{
- String propValue = this.dsProps.getProperty(LOCATORS);
+ String propValue = dsProps.getProperty(LOCATORS);
if (propValue != null && !propValue.isEmpty()) {
throw new IllegalStateException(
"On a client cache the locators property must be set to an empty string or not set. It was set to \""
+ propValue + "\".");
}
}
- this.dsProps.setProperty(MCAST_PORT, "0");
- this.dsProps.setProperty(LOCATORS, "");
- InternalDistributedSystem system =
- (InternalDistributedSystem) DistributedSystem.connect(this.dsProps);
+ dsProps.setProperty(MCAST_PORT, "0");
+ dsProps.setProperty(LOCATORS, "");
+ InternalDistributedSystem system = connectInternalDistributedSystem();
if (instance != null && !instance.isClosed()) {
// this is ok; just make sure it is a client cache
@@ -250,7 +255,7 @@ public class ClientCacheFactory {
}
// check if pool is compatible
- instance.validatePoolFactory(this.pf);
+ instance.validatePoolFactory(pf);
// Check if cache configuration matches.
cacheConfig.validateCacheConfig(instance);
@@ -266,11 +271,16 @@ public class ClientCacheFactory {
}
}
+ @SuppressWarnings("deprecation")
+ private InternalDistributedSystem connectInternalDistributedSystem() {
+ return (InternalDistributedSystem) DistributedSystem.connect(dsProps);
+ }
+
private PoolFactory getPoolFactory() {
- if (this.pf == null) {
- this.pf = PoolManager.createFactory();
+ if (pf == null) {
+ pf = PoolManager.createFactory();
}
- return this.pf;
+ return pf;
}
/**
@@ -651,7 +661,7 @@ public class ClientCacheFactory {
* ClientCacheFactory
*/
public static synchronized ClientCache getAnyInstance() {
- InternalClientCache instance = GemFireCacheImpl.getInstance();
+ InternalClientCache instance = getInternalClientCache();
if (instance == null) {
throw new CacheClosedException(
"A cache has not yet been created.");
@@ -683,7 +693,7 @@ public class ClientCacheFactory {
* @see org.apache.geode.pdx.PdxInstance
*/
public ClientCacheFactory setPdxReadSerialized(boolean pdxReadSerialized) {
- this.cacheConfig.setPdxReadSerialized(pdxReadSerialized);
+ cacheConfig.setPdxReadSerialized(pdxReadSerialized);
return this;
}
@@ -698,7 +708,7 @@ public class ClientCacheFactory {
* @see PdxSerializer
*/
public ClientCacheFactory setPdxSerializer(PdxSerializer serializer) {
- this.cacheConfig.setPdxSerializer(serializer);
+ cacheConfig.setPdxSerializer(serializer);
return this;
}
@@ -717,7 +727,7 @@ public class ClientCacheFactory {
*/
@Deprecated
public ClientCacheFactory setPdxDiskStore(String diskStoreName) {
- this.cacheConfig.setPdxDiskStore(diskStoreName);
+ cacheConfig.setPdxDiskStore(diskStoreName);
return this;
}
@@ -734,7 +744,7 @@ public class ClientCacheFactory {
*/
@Deprecated
public ClientCacheFactory setPdxPersistent(boolean isPersistent) {
- this.cacheConfig.setPdxPersistent(isPersistent);
+ cacheConfig.setPdxPersistent(isPersistent);
return this;
}
@@ -753,7 +763,7 @@ public class ClientCacheFactory {
* @since GemFire 6.6
*/
public ClientCacheFactory setPdxIgnoreUnreadFields(boolean ignore) {
- this.cacheConfig.setPdxIgnoreUnreadFields(ignore);
+ cacheConfig.setPdxIgnoreUnreadFields(ignore);
return this;
}
}
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/Pool.java b/geode-core/src/main/java/org/apache/geode/cache/client/Pool.java
index 48997f8..c00589e 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/Pool.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/Pool.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client;
import java.net.InetSocketAddress;
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/PoolFactory.java b/geode-core/src/main/java/org/apache/geode/cache/client/PoolFactory.java
index 7d9e1a0..a370b28 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/PoolFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/PoolFactory.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client;
import org.apache.geode.cache.InterestResultPolicy;
@@ -184,7 +185,7 @@ public interface PoolFactory {
* <p>
* Current value: 0
*/
- public static final int DEFAULT_SUBSCRIPTION_TIMEOUT_MULTIPLIER = 0;
+ int DEFAULT_SUBSCRIPTION_TIMEOUT_MULTIPLIER = 0;
/**
* The default server group.
@@ -458,7 +459,7 @@ public interface PoolFactory {
* The resulting timeout will be multiplied by 1.25 in order to avoid race conditions with the
* server sending its "ping" message.
*/
- public PoolFactory setSubscriptionTimeoutMultiplier(int multiplier);
+ PoolFactory setSubscriptionTimeoutMultiplier(int multiplier);
/**
* Sets the interval in milliseconds to wait before sending acknowledgements to the cache server
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 22ba018..0a22879 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
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import java.io.ByteArrayInputStream;
@@ -49,7 +50,7 @@ public abstract class AbstractOp implements Op {
private boolean allowDuplicateMetadataRefresh;
protected AbstractOp(int msgType, int msgParts) {
- this.msg = new Message(msgParts, Version.CURRENT);
+ msg = new Message(msgParts, Version.CURRENT);
getMessage().setMessageType(msgType);
}
@@ -57,7 +58,7 @@ public abstract class AbstractOp implements Op {
* Returns the message that this op will send to the server
*/
protected Message getMessage() {
- return this.msg;
+ return msg;
}
protected void initMessagePart() {
@@ -112,26 +113,23 @@ public abstract class AbstractOp implements Op {
if (cnx.getServer().getRequiresCredentials()) {
// Security is enabled on client as well as on server
getMessage().setMessageHasSecurePartFlag();
- long userId = -1;
+ long userId;
if (UserAttributes.userAttributes.get() == null) { // single user mode
userId = cnx.getServer().getUserId();
} else { // multi user mode
- Object id = UserAttributes.userAttributes.get().getServerToId().get(cnx.getServer());
+ Long id = UserAttributes.userAttributes.get().getServerToId().get(cnx.getServer());
if (id == null) {
// This will ensure that this op is retried on another server, unless
// the retryCount is exhausted. Fix for Bug 41501
throw new ServerConnectivityException("Connection error while authenticating user");
}
- userId = (Long) id;
+ userId = id;
}
- HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
- try {
+ try (HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT)) {
hdos.writeLong(cnx.getConnectionID());
hdos.writeLong(userId);
getMessage().setSecurePart(((ConnectionImpl) cnx).encryptBytes(hdos.toByteArray()));
- } finally {
- hdos.close();
}
}
getMessage().send(false);
@@ -249,9 +247,7 @@ public abstract class AbstractOp implements Op {
*/
protected void processAck(Message msg, String opName) throws Exception {
final int msgType = msg.getMessageType();
- if (msgType == MessageType.REPLY) {
- return;
- } else {
+ if (msgType != MessageType.REPLY) {
Part part = msg.getPart(0);
if (msgType == MessageType.EXCEPTION) {
String s = ": While performing a remote " + opName;
@@ -299,11 +295,11 @@ public abstract class AbstractOp implements Op {
}
}
- public boolean isAllowDuplicateMetadataRefresh() {
+ boolean isAllowDuplicateMetadataRefresh() {
return allowDuplicateMetadataRefresh;
}
- public void setAllowDuplicateMetadataRefresh(final boolean allowDuplicateMetadataRefresh) {
+ void setAllowDuplicateMetadataRefresh(final boolean allowDuplicateMetadataRefresh) {
this.allowDuplicateMetadataRefresh = allowDuplicateMetadataRefresh;
}
@@ -328,7 +324,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 void processChunkedResponse(ChunkedMessage msg, String opName, ChunkHandler callback)
+ void processChunkedResponse(ChunkedMessage msg, String opName, ChunkHandler callback)
throws Exception {
msg.readHeader();
final int msgType = msg.getMessageType();
@@ -372,24 +368,24 @@ public abstract class AbstractOp implements Op {
*/
@Override
public Object attempt(Connection cnx) throws Exception {
- this.failed = true;
- this.timedOut = false;
+ failed = true;
+ timedOut = false;
long start = startAttempt(cnx.getStats());
try {
try {
attemptSend(cnx);
- this.failed = false;
+ failed = false;
} finally {
endSendAttempt(cnx.getStats(), start);
}
- this.failed = true;
+ failed = true;
try {
Object result = attemptReadResponse(cnx);
- this.failed = false;
+ failed = false;
return result;
} catch (SocketTimeoutException ste) {
- this.failed = false;
- this.timedOut = true;
+ failed = false;
+ timedOut = true;
throw ste;
}
} finally {
@@ -398,11 +394,11 @@ public abstract class AbstractOp implements Op {
}
protected boolean hasFailed() {
- return this.failed;
+ return failed;
}
protected boolean hasTimedOut() {
- return this.timedOut;
+ return timedOut;
}
protected abstract long startAttempt(ConnectionStats stats);
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AuthenticateUserOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AuthenticateUserOp.java
index 35ef898..ab2b0df 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AuthenticateUserOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AuthenticateUserOp.java
@@ -12,6 +12,7 @@
* 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.apache.geode.distributed.ConfigurationProperties.SECURITY_CLIENT_AUTH_INIT;
@@ -31,7 +32,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.tier.MessageType;
-import org.apache.geode.internal.cache.tier.sockets.ChunkedMessage;
import org.apache.geode.internal.cache.tier.sockets.Handshake;
import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
@@ -65,7 +65,7 @@ public class AuthenticateUserOp {
* @return Object unique user-id.
*/
public static Object executeOn(Connection con, ExecutablePool pool) {
- AbstractOp op = new AuthenticateUserOpImpl(con, pool);
+ AbstractOp op = new AuthenticateUserOpImpl(con);
return pool.executeOn(con, op);
}
@@ -80,7 +80,7 @@ public class AuthenticateUserOp {
*/
public static Object executeOn(ServerLocation location, ExecutablePool pool,
Properties securityProps) {
- AbstractOp op = new AuthenticateUserOpImpl(pool, securityProps);
+ AbstractOp op = new AuthenticateUserOpImpl(securityProps);
return pool.executeOn(location, op);
}
@@ -93,9 +93,9 @@ public class AuthenticateUserOp {
private Properties securityProperties = null;
private boolean needsServerLocation = false;
- public AuthenticateUserOpImpl(Connection con, ExecutablePool pool) {
+ AuthenticateUserOpImpl(Connection con) {
super(MessageType.USER_CREDENTIAL_MESSAGE, 1);
- byte[] credentialBytes = null;
+ byte[] credentialBytes;
DistributedMember server = new InternalDistributedMember(con.getSocket().getInetAddress(),
con.getSocket().getPort(), false);
DistributedSystem sys = InternalDistributedSystem.getConnectedInstance();
@@ -108,27 +108,24 @@ public class AuthenticateUserOp {
(InternalLogWriter) sys.getSecurityLogWriter());
getMessage().setMessageHasSecurePartFlag();
- HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT);
- try {
+ try (HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT)) {
DataSerializer.writeProperties(credentials, heapdos);
credentialBytes = ((ConnectionImpl) con).encryptBytes(heapdos.toByteArray());
} catch (Exception e) {
throw new ServerOperationException(e);
- } finally {
- heapdos.close();
}
getMessage().addBytesPart(credentialBytes);
}
- public AuthenticateUserOpImpl(ExecutablePool pool, Properties securityProps) {
- this(pool, securityProps, false);
+ AuthenticateUserOpImpl(Properties securityProps) {
+ this(securityProps, false);
}
- public AuthenticateUserOpImpl(ExecutablePool pool, Properties securityProps,
+ AuthenticateUserOpImpl(Properties securityProps,
boolean needsServer) {
super(MessageType.USER_CREDENTIAL_MESSAGE, 1);
- this.securityProperties = securityProps;
- this.needsServerLocation = needsServer;
+ securityProperties = securityProps;
+ needsServerLocation = needsServer;
getMessage().setMessageHasSecurePartFlag();
}
@@ -136,24 +133,21 @@ public class AuthenticateUserOp {
@Override
protected void sendMessage(Connection cnx) throws Exception {
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
- byte[] secureBytes = null;
+ byte[] secureBytes;
hdos.writeLong(cnx.getConnectionID());
- if (this.securityProperties != null) {
- byte[] credentialBytes = null;
+ if (securityProperties != null) {
DistributedMember server = new InternalDistributedMember(cnx.getSocket().getInetAddress(),
cnx.getSocket().getPort(), false);
DistributedSystem sys = InternalDistributedSystem.getConnectedInstance();
String authInitMethod = sys.getProperties().getProperty(SECURITY_CLIENT_AUTH_INIT);
- Properties credentials = Handshake.getCredentials(authInitMethod, this.securityProperties,
+ Properties credentials = Handshake.getCredentials(authInitMethod, securityProperties,
server, false, (InternalLogWriter) sys.getLogWriter(),
(InternalLogWriter) sys.getSecurityLogWriter());
- HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT);
- try {
+ byte[] credentialBytes;
+ try (HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT)) {
DataSerializer.writeProperties(credentials, heapdos);
credentialBytes = ((ConnectionImpl) cnx).encryptBytes(heapdos.toByteArray());
- } finally {
- heapdos.close();
}
getMessage().addBytesPart(credentialBytes);
}
@@ -176,34 +170,8 @@ public class AuthenticateUserOp {
}
@Override
- protected Object attemptReadResponse(Connection cnx) throws Exception {
- Message msg = createResponseMessage();
- if (msg != null) {
- msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(),
- cnx.getCommBuffer(), cnx.getStats());
- if (msg instanceof ChunkedMessage) {
- try {
- return processResponse(cnx, msg);
- } finally {
- msg.unsetComms();
- processSecureBytes(cnx, msg);
- }
- } else {
- try {
- msg.receive();
- } finally {
- msg.unsetComms();
- processSecureBytes(cnx, msg);
- }
- return processResponse(cnx, msg);
- }
- } else {
- return null;
- }
- }
-
- protected Object processResponse(Connection cnx, Message msg) throws Exception {
- byte[] bytes = null;
+ protected Object processResponse(Message msg, Connection cnx) throws Exception {
+ byte[] bytes;
Part part = msg.getPart(0);
final int msgType = msg.getMessageType();
long userId = -1;
@@ -217,7 +185,7 @@ public class AuthenticateUserOp {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(decrypted));
userId = dis.readLong();
}
- if (this.needsServerLocation) {
+ if (needsServerLocation) {
return new Object[] {cnx.getServer(), userId};
} else {
return userId;
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/DataSerializerRecoveryListener.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/DataSerializerRecoveryListener.java
index dfc2768..2b0d6bd 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/DataSerializerRecoveryListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/DataSerializerRecoveryListener.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import java.util.concurrent.RejectedExecutionException;
@@ -35,13 +36,13 @@ public class DataSerializerRecoveryListener extends EndpointManager.EndpointList
protected final InternalPool pool;
protected final ScheduledExecutorService background;
protected final long pingInterval;
- protected final Object recoveryScheduledLock = new Object();
- protected boolean recoveryScheduled;
+ private final Object recoveryScheduledLock = new Object();
+ private boolean recoveryScheduled;
public DataSerializerRecoveryListener(ScheduledExecutorService background, InternalPool pool) {
- this.pool = pool;
- this.pingInterval = pool.getPingInterval();
this.background = background;
+ this.pool = pool;
+ pingInterval = pool.getPingInterval();
}
@Override
@@ -114,8 +115,7 @@ public class DataSerializerRecoveryListener extends EndpointManager.EndpointList
} else {
try {
RegisterDataSerializersOp.execute(pool, holders, eventId);
- } catch (CancelException e) {
- return;
+ } catch (CancelException ignored) {
} catch (RejectedExecutionException e) {
// This is probably because we've started to shut down.
if (!pool.getCancelCriterion().isCancelInProgress()) {
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
index 9c45395..cb4d07b 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExecutablePool.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import org.apache.geode.cache.NoSubscriptionServersAvailableException;
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExplicitConnectionSourceImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExplicitConnectionSourceImpl.java
index 9739534..12f94d2 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExplicitConnectionSourceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/ExplicitConnectionSourceImpl.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import java.net.InetSocketAddress;
@@ -264,7 +265,7 @@ public class ExplicitConnectionSourceImpl implements ConnectionSource {
@Override
public ArrayList<ServerLocation> getAllServers() {
- return new ArrayList<>(this.serverList);
+ return new ArrayList<>(serverList);
}
@Override
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/InstantiatorRecoveryListener.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/InstantiatorRecoveryListener.java
index 54fde47..77b034d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/InstantiatorRecoveryListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/InstantiatorRecoveryListener.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import java.util.concurrent.RejectedExecutionException;
@@ -47,13 +48,13 @@ public class InstantiatorRecoveryListener extends EndpointManager.EndpointListen
protected final InternalPool pool;
protected final ScheduledExecutorService background;
protected final long pingInterval;
- protected final Object recoveryScheduledLock = new Object();
- protected boolean recoveryScheduled;
+ private final Object recoveryScheduledLock = new Object();
+ private boolean recoveryScheduled;
public InstantiatorRecoveryListener(ScheduledExecutorService background, InternalPool pool) {
- this.pool = pool;
- this.pingInterval = pool.getPingInterval();
this.background = background;
+ this.pool = pool;
+ pingInterval = pool.getPingInterval();
}
@Override
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/Op.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/Op.java
index 1caa696..9f5dc30 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/Op.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/Op.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
/**
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/OpExecutorImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/OpExecutorImpl.java
index 7b33f59..3f0b5be 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/OpExecutorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/OpExecutorImpl.java
@@ -12,12 +12,11 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
-import java.io.EOFException;
import java.io.IOException;
import java.io.NotSerializableException;
-import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.BufferUnderflowException;
@@ -84,28 +83,17 @@ public class OpExecutorImpl implements ExecutablePool {
private final QueueManager queueManager;
private final CancelCriterion cancelCriterion;
private /* final */ PoolImpl pool;
- private final ThreadLocal<Boolean> serverAffinity = new ThreadLocal<Boolean>() {
- @Override
- protected Boolean initialValue() {
- return Boolean.FALSE;
- };
- };
+ private final ThreadLocal<Boolean> serverAffinity = ThreadLocal.withInitial(() -> Boolean.FALSE);
private boolean serverAffinityFailover = false;
- private final ThreadLocal<ServerLocation> affinityServerLocation =
- new ThreadLocal<ServerLocation>();
+ private final ThreadLocal<ServerLocation> affinityServerLocation = new ThreadLocal<>();
- private final ThreadLocal<Integer> affinityRetryCount = new ThreadLocal<Integer>() {
- @Override
- protected Integer initialValue() {
- return 0;
- };
- };
+ private final ThreadLocal<Integer> affinityRetryCount = ThreadLocal.withInitial(() -> 0);
- public OpExecutorImpl(ConnectionManager manager, QueueManager queueManager,
+ public OpExecutorImpl(ConnectionManager connectionManager, QueueManager queueManager,
EndpointManager endpointManager, RegisterInterestTracker riTracker, int retryAttempts,
long serverTimeout, CancelCriterion cancelCriterion,
PoolImpl pool) {
- this.connectionManager = manager;
+ this.connectionManager = connectionManager;
this.queueManager = queueManager;
this.endpointManager = endpointManager;
this.riTracker = riTracker;
@@ -122,18 +110,17 @@ public class OpExecutorImpl implements ExecutablePool {
@Override
public Object execute(Op op, int retries) {
- if (this.serverAffinity.get()) {
- ServerLocation loc = this.affinityServerLocation.get();
+ if (serverAffinity.get()) {
+ ServerLocation loc = affinityServerLocation.get();
if (loc == null) {
loc = getNextOpServerLocation();
- this.affinityServerLocation.set(loc);
+ affinityServerLocation.set(loc);
if (logger.isDebugEnabled()) {
- logger.debug("setting server affinity to {}", this.affinityServerLocation.get());
+ logger.debug("setting server affinity to {}", affinityServerLocation.get());
}
}
return executeWithServerAffinity(loc, op);
}
- boolean success = false;
Connection conn = connectionManager.borrowConnection(serverTimeout);
try {
@@ -148,9 +135,7 @@ public class OpExecutorImpl implements ExecutablePool {
}
try {
authenticateIfRequired(conn, op);
- Object result = executeWithPossibleReAuthentication(conn, op);
- success = true;
- return result;
+ return executeWithPossibleReAuthentication(conn, op);
} catch (MessageTooLargeException e) {
throw new GemFireIOException("unable to transmit message to server", e);
} catch (Exception e) {
@@ -200,7 +185,7 @@ public class OpExecutorImpl implements ExecutablePool {
if (logger.isDebugEnabled()) {
logger.debug("caught exception while executing with affinity:{}", e.getMessage(), e);
}
- if (!this.serverAffinityFailover || e instanceof ServerOperationException) {
+ if (!serverAffinityFailover || e instanceof ServerOperationException) {
throw e;
}
int retryCount = getAffinityRetryCount();
@@ -211,7 +196,7 @@ public class OpExecutorImpl implements ExecutablePool {
}
setAffinityRetryCount(retryCount + 1);
}
- this.affinityServerLocation.set(null);
+ affinityServerLocation.set(null);
if (logger.isDebugEnabled()) {
logger.debug("reset server affinity: attempting txFailover");
}
@@ -222,17 +207,17 @@ public class OpExecutorImpl implements ExecutablePool {
int transactionId = absOp.getMessage().getTransactionId();
// for CommitOp we do not have transactionId in AbstractOp
// so set it explicitly for TXFailoverOp
- TXFailoverOp.execute(this.pool, transactionId);
+ TXFailoverOp.execute(pool, transactionId);
if (op instanceof ExecuteRegionFunctionOpImpl) {
- op = new ExecuteRegionFunctionOpImpl((ExecuteRegionFunctionOpImpl) op,
- (byte) 1/* isReExecute */, new HashSet<String>());
+ op = new ExecuteRegionFunctionOpImpl((ExecuteRegionFunctionOpImpl) op, (byte) 1,
+ new HashSet<>());
((ExecuteRegionFunctionOpImpl) op).getMessage().setTransactionId(transactionId);
} else if (op instanceof ExecuteFunctionOpImpl) {
op = new ExecuteFunctionOpImpl((ExecuteFunctionOpImpl) op, (byte) 1/* isReExecute */);
((ExecuteFunctionOpImpl) op).getMessage().setTransactionId(transactionId);
}
- return this.pool.execute(op);
+ return pool.execute(op);
} finally {
if (initialRetryCount == 0) {
setAffinityRetryCount(0);
@@ -245,8 +230,8 @@ public class OpExecutorImpl implements ExecutablePool {
if (logger.isDebugEnabled()) {
logger.debug("setting up server affinity");
}
- this.serverAffinityFailover = allowFailover;
- this.serverAffinity.set(Boolean.TRUE);
+ serverAffinityFailover = allowFailover;
+ serverAffinity.set(Boolean.TRUE);
}
@Override
@@ -254,13 +239,13 @@ public class OpExecutorImpl implements ExecutablePool {
if (logger.isDebugEnabled()) {
logger.debug("reset server affinity");
}
- this.serverAffinity.set(Boolean.FALSE);
- this.affinityServerLocation.set(null);
+ serverAffinity.set(Boolean.FALSE);
+ affinityServerLocation.set(null);
}
@Override
public ServerLocation getServerAffinityLocation() {
- return this.affinityServerLocation.get();
+ return affinityServerLocation.get();
}
int getAffinityRetryCount() {
@@ -273,8 +258,8 @@ public class OpExecutorImpl implements ExecutablePool {
@Override
public void setServerAffinityLocation(ServerLocation serverLocation) {
- assert this.affinityServerLocation.get() == null;
- this.affinityServerLocation.set(serverLocation);
+ assert affinityServerLocation.get() == null;
+ affinityServerLocation.set(serverLocation);
}
public ServerLocation getNextOpServerLocation() {
@@ -282,7 +267,7 @@ public class OpExecutorImpl implements ExecutablePool {
try {
return conn.getServer();
} finally {
- this.connectionManager.returnConnection(conn);
+ connectionManager.returnConnection(conn);
}
}
@@ -301,12 +286,12 @@ public class OpExecutorImpl implements ExecutablePool {
public Object executeOn(ServerLocation p_server, Op op, boolean accessed,
boolean onlyUseExistingCnx) {
ServerLocation server = p_server;
- if (this.serverAffinity.get()) {
- ServerLocation affinityserver = this.affinityServerLocation.get();
+ if (serverAffinity.get()) {
+ ServerLocation affinityserver = affinityServerLocation.get();
if (affinityserver != null) {
server = affinityserver;
} else {
- this.affinityServerLocation.set(server);
+ affinityServerLocation.set(server);
}
// redirect to executeWithServerAffinity so that we
// can send a TXFailoverOp.
@@ -317,19 +302,18 @@ public class OpExecutorImpl implements ExecutablePool {
protected Object executeOnServer(ServerLocation p_server, Op op, boolean accessed,
boolean onlyUseExistingCnx) {
- ServerLocation server = p_server;
boolean returnCnx = true;
boolean pingOp = (op instanceof PingOp.PingOpImpl);
Connection conn = null;
if (pingOp) {
// currently for pings we prefer to queue clientToServer cnx so that we will
// not create a pooled cnx when all we have is queue cnxs.
- if (this.queueManager != null) {
+ if (queueManager != null) {
// see if our QueueManager has a connection to this server that we can send
// the ping on.
- Endpoint ep = (Endpoint) this.endpointManager.getEndpointMap().get(server);
+ Endpoint ep = endpointManager.getEndpointMap().get(p_server);
if (ep != null) {
- QueueConnections qcs = this.queueManager.getAllConnectionsNoWait();
+ QueueConnections qcs = queueManager.getAllConnectionsNoWait();
conn = qcs.getConnection(ep);
if (conn != null) {
// we found one to do the ping on
@@ -339,23 +323,21 @@ public class OpExecutorImpl implements ExecutablePool {
}
}
if (conn == null) {
- conn = connectionManager.borrowConnection(server, serverTimeout, onlyUseExistingCnx);
+ conn = connectionManager.borrowConnection(p_server, serverTimeout, onlyUseExistingCnx);
}
- boolean success = true;
try {
return executeWithPossibleReAuthentication(conn, op);
} catch (Exception e) {
- success = false;
handleException(e, conn, 0, true);
// this shouldn't actually be reached, handle exception will throw something
throw new ServerConnectivityException("Received error connecting to server", e);
} finally {
- if (this.serverAffinity.get() && this.affinityServerLocation.get() == null) {
+ if (serverAffinity.get() && affinityServerLocation.get() == null) {
if (logger.isDebugEnabled()) {
logger.debug("setting server affinity to {} server:{}", conn.getEndpoint().getMemberId(),
conn.getServer());
}
- this.affinityServerLocation.set(conn.getServer());
+ affinityServerLocation.set(conn.getServer());
}
if (returnCnx) {
connectionManager.returnConnection(conn, accessed);
@@ -376,7 +358,7 @@ public class OpExecutorImpl implements ExecutablePool {
throw new SubscriptionNotEnabledException();
}
- HashSet attemptedPrimaries = new HashSet();
+ HashSet<ServerLocation> attemptedPrimaries = new HashSet<>();
while (true) {
Connection primary = queueManager.getAllConnections().getPrimary();
try {
@@ -414,9 +396,8 @@ public class OpExecutorImpl implements ExecutablePool {
}
}
- List backups = connections.getBackups();
- for (int i = 0; i < backups.size(); i++) {
- Connection conn = (Connection) backups.get(i);
+ List<Connection> backups = connections.getBackups();
+ for (Connection conn : backups) {
try {
executeWithPossibleReAuthentication(conn, op);
} catch (Exception e) {
@@ -461,7 +442,7 @@ public class OpExecutorImpl implements ExecutablePool {
}
Connection primary = connections.getPrimary();
- HashSet attemptedPrimaries = new HashSet();
+ HashSet<ServerLocation> attemptedPrimaries = new HashSet<>();
while (true) {
try {
if (logger.isTraceEnabled(LogMarker.BRIDGE_SERVER_VERBOSE)) {
@@ -627,8 +608,7 @@ public class OpExecutorImpl implements ExecutablePool {
invalidateServer = false;
} else {
Throwable t = e.getCause();
- if ((t instanceof ConnectException) || (t instanceof SocketException)
- || (t instanceof SocketTimeoutException) || (t instanceof IOException)
+ if ((t instanceof IOException)
|| (t instanceof SerializationException) || (t instanceof CopyException)
|| (t instanceof GemFireSecurityException) || (t instanceof ServerOperationException)
|| (t instanceof TransactionException) || (t instanceof CancelException)) {
@@ -666,7 +646,7 @@ public class OpExecutorImpl implements ExecutablePool {
boolean logEnabled = warn ? logger.isWarnEnabled() : logger.isDebugEnabled();
boolean msgNeeded = logEnabled || finalAttempt;
if (msgNeeded) {
- final StringBuffer sb = getExceptionMessage(title, retryCount, finalAttempt, conn, e);
+ final StringBuffer sb = getExceptionMessage(title, retryCount, finalAttempt, conn);
final String msg = sb.toString();
if (logEnabled) {
if (warn) {
@@ -686,7 +666,7 @@ public class OpExecutorImpl implements ExecutablePool {
}
private StringBuffer getExceptionMessage(String exceptionName, int retryCount,
- boolean finalAttempt, Connection connection, Throwable ex) {
+ boolean finalAttempt, Connection connection) {
StringBuffer message = new StringBuffer(200);
message.append("Pool unexpected ").append(exceptionName);
if (connection != null) {
@@ -708,23 +688,21 @@ public class OpExecutorImpl implements ExecutablePool {
return;
}
- if (this.pool == null) {
+ if (pool == null) {
PoolImpl poolImpl =
- (PoolImpl) PoolManagerImpl.getPMI().find(this.endpointManager.getPoolName());
+ (PoolImpl) PoolManagerImpl.getPMI().find(endpointManager.getPoolName());
if (poolImpl == null) {
return;
}
- this.pool = poolImpl;
+ pool = poolImpl;
}
- if (this.pool.getMultiuserAuthentication()) {
+ if (pool.getMultiuserAuthentication()) {
if (((AbstractOp) op).needsUserId()) {
UserAttributes ua = UserAttributes.userAttributes.get();
if (ua != null) {
if (!ua.getServerToId().containsKey(conn.getServer())) {
- authenticateMultiuser(this.pool, conn, ua);
+ authenticateMultiuser(pool, conn, ua);
}
- } else {
- // This should never be reached.
}
}
} else if (((AbstractOp) op).needsUserId()) {
@@ -732,7 +710,7 @@ public class OpExecutorImpl implements ExecutablePool {
// reached.
if (conn.getServer().getUserId() == -1) {
Connection connImpl = conn.getWrappedConnection();
- conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, this.pool));
+ conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, pool));
if (logger.isDebugEnabled()) {
logger.debug(
"OpExecutorImpl.execute() - single user mode - authenticated this user on {}", conn);
@@ -754,13 +732,12 @@ public class OpExecutorImpl implements ExecutablePool {
}
} catch (ServerConnectivityException sce) {
Throwable cause = sce.getCause();
- if (cause instanceof SocketException || cause instanceof EOFException
- || cause instanceof IOException || cause instanceof BufferUnderflowException
+ if (cause instanceof IOException || cause instanceof BufferUnderflowException
|| cause instanceof CancelException
|| (sce.getMessage() != null
- && (sce.getMessage().indexOf("Could not create a new connection to server") != -1
- || sce.getMessage().indexOf("socket timed out on client") != -1
- || sce.getMessage().indexOf("connection was asynchronously destroyed") != -1))) {
+ && (sce.getMessage().contains("Could not create a new connection to server")
+ || sce.getMessage().contains("socket timed out on client")
+ || sce.getMessage().contains("connection was asynchronously destroyed")))) {
throw new ServerConnectivityException("Connection error while authenticating user");
} else {
throw sce;
@@ -781,7 +758,7 @@ public class OpExecutorImpl implements ExecutablePool {
// 2nd exception-message above is from AbstractOp.sendMessage()
PoolImpl pool =
- (PoolImpl) PoolManagerImpl.getPMI().find(this.endpointManager.getPoolName());
+ (PoolImpl) PoolManagerImpl.getPMI().find(endpointManager.getPoolName());
if (!pool.getMultiuserAuthentication()) {
Connection connImpl = conn.getWrappedConnection();
conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, this));
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
index 1cde95f..8af6399 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
@@ -19,7 +19,6 @@ import static org.apache.commons.lang3.StringUtils.isEmpty;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -38,7 +37,6 @@ import org.apache.geode.StatisticsFactory;
import org.apache.geode.SystemFailure;
import org.apache.geode.annotations.internal.MakeNotStatic;
import org.apache.geode.annotations.internal.MutableForTesting;
-import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.NoSubscriptionServersAvailableException;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionService;
@@ -94,7 +92,7 @@ public class PoolImpl implements InternalPool {
* servers.
*/
@MutableForTesting
- public static volatile boolean TEST_DURABLE_IS_NET_DOWN = false;
+ static volatile boolean TEST_DURABLE_IS_NET_DOWN = false;
private final String name;
private final int socketConnectTimeout;
@@ -135,7 +133,7 @@ public class PoolImpl implements InternalPool {
private ScheduledExecutorService backgroundProcessor;
private final OpExecutorImpl executor;
private final RegisterInterestTracker riTracker = new RegisterInterestTracker();
- private final InternalDistributedSystem dsys;
+ private final InternalDistributedSystem distributedSystem;
private InternalCache cache;
private final ClientProxyMembershipID proxyId;
@@ -171,7 +169,7 @@ public class PoolImpl implements InternalPool {
/**
* @since GemFire 5.7
*/
- protected void finishCreate(PoolManagerImpl pm) {
+ private void finishCreate(PoolManagerImpl pm) {
pm.register(this);
try {
start();
@@ -186,74 +184,76 @@ public class PoolImpl implements InternalPool {
}
protected PoolImpl(PoolManagerImpl pm, String name, Pool attributes,
- List<HostAddress> locAddresses, InternalDistributedSystem distributedSystem,
- InternalCache cache, ThreadsMonitoring tMonitoring) {
- this.threadMonitoring = tMonitoring;
+ List<HostAddress> locatorAddresses, InternalDistributedSystem distributedSystem,
+ InternalCache cache, ThreadsMonitoring threadMonitoring) {
this.pm = pm;
this.name = name;
- this.socketConnectTimeout = attributes.getSocketConnectTimeout();
- this.freeConnectionTimeout = attributes.getFreeConnectionTimeout();
- this.loadConditioningInterval = attributes.getLoadConditioningInterval();
- this.socketBufferSize = attributes.getSocketBufferSize();
- this.threadLocalConnections = attributes.getThreadLocalConnections();
- this.readTimeout = attributes.getReadTimeout();
- this.minConnections = attributes.getMinConnections();
- this.maxConnections = attributes.getMaxConnections();
- this.retryAttempts = attributes.getRetryAttempts();
- this.idleTimeout = attributes.getIdleTimeout();
- this.pingInterval = attributes.getPingInterval();
- this.statisticInterval = attributes.getStatisticInterval();
- this.subscriptionEnabled = attributes.getSubscriptionEnabled();
- this.prSingleHopEnabled = attributes.getPRSingleHopEnabled();
- this.subscriptionRedundancyLevel = attributes.getSubscriptionRedundancy();
- this.subscriptionMessageTrackingTimeout = attributes.getSubscriptionMessageTrackingTimeout();
- this.subscriptionAckInterval = attributes.getSubscriptionAckInterval();
- this.subscriptionTimeoutMultiplier = attributes.getSubscriptionTimeoutMultiplier();
- if (this.subscriptionTimeoutMultiplier < 0) {
- throw new IllegalArgumentException("The subscription timeout multipler must not be negative");
- }
- this.serverGroup = attributes.getServerGroup();
- this.multiuserSecureModeEnabled = attributes.getMultiuserAuthentication();
- this.locatorAddresses = locAddresses;
- this.locators = attributes.getLocators();
- this.servers = attributes.getServers();
- this.startDisabled =
- ((PoolFactoryImpl.PoolAttributes) attributes).startDisabled || !pm.isNormal();
- this.usedByGateway = ((PoolFactoryImpl.PoolAttributes) attributes).isGateway();
- this.gatewaySender = ((PoolFactoryImpl.PoolAttributes) attributes).getGatewaySender();
- this.dsys = distributedSystem;
- if (this.dsys == null) {
+ this.locatorAddresses = locatorAddresses;
+ if (distributedSystem == null) {
throw new IllegalStateException(
"Distributed System must be created before creating pool");
}
+ this.distributedSystem = distributedSystem;
this.cache = cache;
- this.securityLogWriter = this.dsys.getSecurityInternalLogWriter();
- if (!this.dsys.getConfig().getStatisticSamplingEnabled() && this.statisticInterval > 0) {
+ this.threadMonitoring = threadMonitoring;
+
+ socketConnectTimeout = attributes.getSocketConnectTimeout();
+ freeConnectionTimeout = attributes.getFreeConnectionTimeout();
+ loadConditioningInterval = attributes.getLoadConditioningInterval();
+ socketBufferSize = attributes.getSocketBufferSize();
+ threadLocalConnections = attributes.getThreadLocalConnections();
+ readTimeout = attributes.getReadTimeout();
+ minConnections = attributes.getMinConnections();
+ maxConnections = attributes.getMaxConnections();
+ retryAttempts = attributes.getRetryAttempts();
+ idleTimeout = attributes.getIdleTimeout();
+ pingInterval = attributes.getPingInterval();
+ statisticInterval = attributes.getStatisticInterval();
+ subscriptionEnabled = attributes.getSubscriptionEnabled();
+ prSingleHopEnabled = attributes.getPRSingleHopEnabled();
+ subscriptionRedundancyLevel = attributes.getSubscriptionRedundancy();
+ subscriptionMessageTrackingTimeout = attributes.getSubscriptionMessageTrackingTimeout();
+ subscriptionAckInterval = attributes.getSubscriptionAckInterval();
+ subscriptionTimeoutMultiplier = attributes.getSubscriptionTimeoutMultiplier();
+ if (subscriptionTimeoutMultiplier < 0) {
+ throw new IllegalArgumentException("The subscription timeout multipler must not be negative");
+ }
+ serverGroup = attributes.getServerGroup();
+ multiuserSecureModeEnabled = attributes.getMultiuserAuthentication();
+ locators = attributes.getLocators();
+ servers = attributes.getServers();
+ startDisabled =
+ ((PoolFactoryImpl.PoolAttributes) attributes).startDisabled || !pm.isNormal();
+ usedByGateway = ((PoolFactoryImpl.PoolAttributes) attributes).isGateway();
+ gatewaySender = ((PoolFactoryImpl.PoolAttributes) attributes).getGatewaySender();
+ securityLogWriter = distributedSystem.getSecurityInternalLogWriter();
+ if (!distributedSystem.getConfig().getStatisticSamplingEnabled() && statisticInterval > 0) {
logger.info("statistic-sampling must be enabled for sampling rate of {} to take affect",
- this.statisticInterval);
+ statisticInterval);
}
- this.cancelCriterion = new Stopper();
+ cancelCriterion = new Stopper();
if (Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "SPECIAL_DURABLE")) {
ClientProxyMembershipID.setPoolName(name);
- this.proxyId = ClientProxyMembershipID.getNewProxyMembership(this.dsys);
+ proxyId = ClientProxyMembershipID.getNewProxyMembership(distributedSystem);
ClientProxyMembershipID.setPoolName(null);
} else {
- this.proxyId = ClientProxyMembershipID.getNewProxyMembership(this.dsys);
+ proxyId = ClientProxyMembershipID.getNewProxyMembership(distributedSystem);
}
- StatisticsFactory statFactory = null;
- if (this.gatewaySender != null) {
+ StatisticsFactory statFactory;
+ if (gatewaySender != null) {
statFactory = new DummyStatisticsFactory();
} else {
- statFactory = this.dsys;
+ statFactory = distributedSystem;
}
- this.stats = this.startDisabled ? null
+ stats = startDisabled ? null
: new PoolStats(statFactory, getName() + "->"
+ (isEmpty(serverGroup) ? "[any servers]" : "[" + getServerGroup() + "]"));
source = getSourceImpl(((PoolFactoryImpl.PoolAttributes) attributes).locatorCallback);
- endpointManager = new EndpointManagerImpl(name, this.dsys, this.cancelCriterion, this.stats);
- connectionFactory = new ConnectionFactoryImpl(source, endpointManager, this.dsys,
- socketBufferSize, socketConnectTimeout, readTimeout, proxyId, this.cancelCriterion,
+ endpointManager = new EndpointManagerImpl(name, distributedSystem, cancelCriterion,
+ stats);
+ connectionFactory = new ConnectionFactoryImpl(source, endpointManager, distributedSystem,
+ socketBufferSize, socketConnectTimeout, readTimeout, proxyId, cancelCriterion,
usedByGateway, gatewaySender, pingInterval, multiuserSecureModeEnabled, this);
if (subscriptionEnabled) {
queueManager = new QueueManagerImpl(this, endpointManager, source, connectionFactory,
@@ -267,10 +267,10 @@ public class PoolImpl implements InternalPool {
// an exception, by passing in the poolOrCache stopper
executor = new OpExecutorImpl(manager, queueManager, endpointManager, riTracker, retryAttempts,
freeConnectionTimeout, new PoolOrCacheStopper(), this);
- if (this.multiuserSecureModeEnabled) {
- this.proxyCacheList = new ArrayList<ProxyCache>();
+ if (multiuserSecureModeEnabled) {
+ proxyCacheList = new ArrayList<>();
} else {
- this.proxyCacheList = null;
+ proxyCacheList = null;
}
}
@@ -305,7 +305,7 @@ public class PoolImpl implements InternalPool {
}
private void start() {
- if (this.startDisabled)
+ if (startDisabled)
return;
final boolean isDebugEnabled = logger.isDebugEnabled();
@@ -342,13 +342,13 @@ public class PoolImpl implements InternalPool {
}
- if (this.statisticInterval > 0 && this.dsys.getConfig().getStatisticSamplingEnabled()) {
+ if (statisticInterval > 0 && distributedSystem.getConfig().getStatisticSamplingEnabled()) {
backgroundProcessor.scheduleWithFixedDelay(new PublishClientStatsTask(), statisticInterval,
statisticInterval, TimeUnit.MILLISECONDS);
}
// LOG: changed from config to info
logger.info("Pool {} started with multiuser-authentication={}",
- new Object[] {this.name, this.multiuserSecureModeEnabled});
+ new Object[] {name, multiuserSecureModeEnabled});
}
/**
@@ -358,7 +358,7 @@ public class PoolImpl implements InternalPool {
*/
@Override
public CancelCriterion getCancelCriterion() {
- return this.cancelCriterion;
+ return cancelCriterion;
}
@Override
@@ -373,22 +373,22 @@ public class PoolImpl implements InternalPool {
@Override
public String getName() {
- return this.name;
+ return name;
}
@Override
public int getSocketConnectTimeout() {
- return this.socketConnectTimeout;
+ return socketConnectTimeout;
}
@Override
public int getFreeConnectionTimeout() {
- return this.freeConnectionTimeout;
+ return freeConnectionTimeout;
}
@Override
public int getLoadConditioningInterval() {
- return this.loadConditioningInterval;
+ return loadConditioningInterval;
}
@Override
@@ -418,42 +418,42 @@ public class PoolImpl implements InternalPool {
@Override
public int getStatisticInterval() {
- return this.statisticInterval;
+ return statisticInterval;
}
@Override
public int getSocketBufferSize() {
- return this.socketBufferSize;
+ return socketBufferSize;
}
@Override
public boolean getThreadLocalConnections() {
- return this.threadLocalConnections;
+ return threadLocalConnections;
}
@Override
public int getReadTimeout() {
- return this.readTimeout;
+ return readTimeout;
}
@Override
public boolean getSubscriptionEnabled() {
- return this.subscriptionEnabled;
+ return subscriptionEnabled;
}
@Override
public boolean getPRSingleHopEnabled() {
- return this.prSingleHopEnabled;
+ return prSingleHopEnabled;
}
@Override
public int getSubscriptionRedundancy() {
- return this.subscriptionRedundancyLevel;
+ return subscriptionRedundancyLevel;
}
@Override
public int getSubscriptionMessageTrackingTimeout() {
- return this.subscriptionMessageTrackingTimeout;
+ return subscriptionMessageTrackingTimeout;
}
@Override
@@ -463,37 +463,33 @@ public class PoolImpl implements InternalPool {
@Override
public String getServerGroup() {
- return this.serverGroup;
+ return serverGroup;
}
@Override
public boolean getMultiuserAuthentication() {
- return this.multiuserSecureModeEnabled;
+ return multiuserSecureModeEnabled;
}
@Override
public List<InetSocketAddress> getLocators() {
- return this.locators;
+ return locators;
}
@Override
public List<InetSocketAddress> getOnlineLocators() {
- return this.source.getOnlineLocators();
+ return source.getOnlineLocators();
}
@Override
public List<InetSocketAddress> getServers() {
- return this.servers;
+ return servers;
}
public GatewaySender getGatewaySender() {
return gatewaySender;
}
- public InternalLogWriter getSecurityInternalLogWriter() {
- return this.securityLogWriter;
- }
-
@Override
public void destroy() {
destroy(false);
@@ -501,10 +497,7 @@ public class PoolImpl implements InternalPool {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder(100);
- sb.append(this.getClass().getSimpleName()).append('@').append(System.identityHashCode(this))
- .append(" name=").append(getName());
- return sb.toString();
+ return getClass().getSimpleName() + '@' + System.identityHashCode(this) + " name=" + getName();
}
@Override
@@ -519,51 +512,46 @@ public class PoolImpl implements InternalPool {
if (SPECIAL_DURABLE) {
synchronized (simpleLock) {
try {
- if (cache == null && dsys != null) {
- cache = dsys.getCache();
+ if (cache == null && distributedSystem != null) {
+ cache = distributedSystem.getCache();
if (cache == null) {
- throw new IllegalStateException(
- "Cache must be created before creating pool");
+ throw new IllegalStateException("Cache must be created before creating pool");
}
}
- if (!cache.isClosed() && this.getPoolOrCacheCancelInProgress() == null) {
+ if (!cache.isClosed() && getPoolOrCacheCancelInProgress() == null) {
Set<Region<?, ?>> regions = cache.rootRegions();
for (Region<?, ?> roots : regions) {
Set<Region<?, ?>> subregions = roots.subregions(true);
for (Region<?, ?> subroots : subregions) {
if (!subroots.isDestroyed() && subroots.getAttributes().getPoolName() != null
- && subroots.getAttributes().getPoolName().equals(this.name)) {
+ && subroots.getAttributes().getPoolName().equals(name)) {
if (logger.isDebugEnabled()) {
logger.debug(
"PoolImpl.destroy[ Region connected count:{} Region subroot closing:{} Pool Name:{} ]",
- cnt, subroots.getName(), this.name);
+ cnt, subroots.getName(), name);
}
subroots.close();
}
}
if (!roots.isDestroyed() && roots.getAttributes().getPoolName() != null
- && roots.getAttributes().getPoolName().equals(this.name)) {
+ && roots.getAttributes().getPoolName().equals(name)) {
if (logger.isDebugEnabled()) {
logger.debug(
"PoolImpl.destroy[ Region connected count:{} Region root closing:{} Pool Name:{} ]",
- cnt, roots.getName(), this.name);
+ cnt, roots.getName(), name);
}
roots.close();
}
}
}
- } catch (CacheClosedException ccex) {
- if (logger.isDebugEnabled()) {
- logger.debug(ccex.getMessage(), ccex);
- }
- } catch (Exception ex) {
+ } catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug(ex.getMessage(), ex);
+ logger.debug(e.getMessage(), e);
}
}
}
- } // end special case
+ }
cnt = getAttachCount();
if (cnt > 0) {
@@ -572,7 +560,7 @@ public class PoolImpl implements InternalPool {
cnt));
}
}
- if (this.pm.unregister(this)) {
+ if (pm.unregister(this)) {
basicDestroy(keepAlive);
}
}
@@ -583,7 +571,7 @@ public class PoolImpl implements InternalPool {
*/
public synchronized void basicDestroy(boolean keepAlive) {
if (!isDestroyed()) {
- this.destroyed = true;
+ destroyed = true;
this.keepAlive = keepAlive;
// LOG: changed from config to info
logger.info("Destroying connection pool {}", name);
@@ -602,15 +590,15 @@ public class PoolImpl implements InternalPool {
}
try {
- if (this.source != null) {
- this.source.stop();
+ if (source != null) {
+ source.stop();
}
} catch (RuntimeException e) {
logger.error("Error encountered while stopping connection source.", e);
}
try {
- if (this.queueManager != null) {
+ if (queueManager != null) {
queueManager.close(keepAlive);
}
} catch (RuntimeException e) {
@@ -620,7 +608,7 @@ public class PoolImpl implements InternalPool {
}
try {
- if (this.manager != null) {
+ if (manager != null) {
manager.close(keepAlive);
}
} catch (RuntimeException e) {
@@ -634,8 +622,8 @@ public class PoolImpl implements InternalPool {
}
try {
- if (this.stats != null) {
- this.stats.close();
+ if (stats != null) {
+ stats.close();
}
} catch (RuntimeException e) {
logger.error("Error while closing statistics", e);
@@ -668,9 +656,8 @@ public class PoolImpl implements InternalPool {
*/
public void sameAs(Object obj) {
if (!(obj instanceof PoolImpl)) {
- throw new RuntimeException(
- String.format("%s is not the same as %s because it should have been a PoolImpl",
- new Object[] {this, obj}));
+ throw new RuntimeException(String
+ .format("%s is not the same as %s because it should have been a PoolImpl", this, obj));
}
PoolImpl other = (PoolImpl) obj;
if (!getName().equals(other.getName())) {
@@ -758,7 +745,7 @@ public class PoolImpl implements InternalPool {
@Override
public PoolStats getStats() {
- return this.stats;
+ return stats;
}
@@ -887,14 +874,14 @@ public class PoolImpl implements InternalPool {
@Override
public RegisterInterestTracker getRITracker() {
- return this.riTracker;
+ return riTracker;
}
/**
* Test hook that returns the number of servers we currently have connections to.
*/
public int getConnectedServerCount() {
- return this.endpointManager.getConnectedServerCount();
+ return endpointManager.getConnectedServerCount();
}
/**
@@ -906,11 +893,7 @@ public class PoolImpl implements InternalPool {
* @since GemFire 5.1
*/
public boolean verifyIfDuplicate(EventID eventId) {
- return ((QueueStateImpl) this.queueManager.getState()).verifyIfDuplicate(eventId);
- }
-
- public boolean verifyIfDuplicate(EventID eventId, boolean addToMap) {
- return ((QueueStateImpl) this.queueManager.getState()).verifyIfDuplicate(eventId);
+ return queueManager.getState().verifyIfDuplicate(eventId);
}
/**
@@ -954,18 +937,18 @@ public class PoolImpl implements InternalPool {
* Test hook that returns the ThreadIdToSequenceIdMap
*/
public Map getThreadIdToSequenceIdMap() {
- if (this.queueManager == null)
+ if (queueManager == null)
return Collections.emptyMap();
- if (this.queueManager.getState() == null)
+ if (queueManager.getState() == null)
return Collections.emptyMap();
- return this.queueManager.getState().getThreadIdToSequenceIdMap();
+ return queueManager.getState().getThreadIdToSequenceIdMap();
}
/**
* Test hook that returns true if we have a primary and its updater thread is alive.
*/
public boolean isPrimaryUpdaterAlive() {
- return ((QueueManagerImpl) this.queueManager).isPrimaryUpdaterAlive();
+ return ((QueueManagerImpl) queueManager).isPrimaryUpdaterAlive();
}
/**
@@ -974,8 +957,8 @@ public class PoolImpl implements InternalPool {
public void killPrimaryEndpoint() // throws ServerException
{
boolean ok = false;
- if (this.queueManager != null) {
- QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
+ if (queueManager != null) {
+ QueueManager.QueueConnections cons = queueManager.getAllConnections();
Connection con = cons.getPrimary();
if (con != null) {
final String msg = "killing primary endpoint";
@@ -996,40 +979,27 @@ public class PoolImpl implements InternalPool {
}
}
- // Pool that are declared in a cache.xml will set this property to true.
- private boolean declaredInXML;
-
- public void setDeclaredInXML(boolean v) {
- this.declaredInXML = v;
- }
-
- public boolean getDeclaredInXML() {
- return this.declaredInXML;
- }
-
// used by unit tests to confirm if readyForEvents has been called on a pool
private boolean readyForEventsCalled;
public boolean getReadyForEventsCalled() {
- return this.readyForEventsCalled;
+ return readyForEventsCalled;
}
public void readyForEvents(InternalDistributedSystem system) {
if (!isDurableClient() || queueManager == null) {
return;
}
- this.readyForEventsCalled = true;
+ readyForEventsCalled = true;
queueManager.readyForEvents(system);
}
@Override
public boolean isDurableClient() {
- boolean isDurable = false;
- DistributionConfig config = dsys.getConfig();
+ DistributionConfig config = distributedSystem.getConfig();
String durableClientId = config.getDurableClientId();
- isDurable = durableClientId != null && durableClientId.length() > 0;
- return isDurable;
+ return durableClientId != null && durableClientId.length() > 0;
}
/**
@@ -1064,8 +1034,8 @@ public class PoolImpl implements InternalPool {
*/
public ServerLocation getPrimary() {
ServerLocation result = null;
- if (this.queueManager != null) {
- QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
+ if (queueManager != null) {
+ QueueManager.QueueConnections cons = queueManager.getAllConnections();
Connection con = cons.getPrimary();
result = con.getServer();
}
@@ -1076,8 +1046,8 @@ public class PoolImpl implements InternalPool {
* Test hook to get a connection to the primary server.
*/
public Connection getPrimaryConnection() {
- if (this.queueManager != null) {
- QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
+ if (queueManager != null) {
+ QueueManager.QueueConnections cons = queueManager.getAllConnections();
return cons.getPrimary();
}
return null;
@@ -1088,15 +1058,13 @@ public class PoolImpl implements InternalPool {
* redundant server. An empty list is returned if we have no redundant servers.
*/
public List<String> getRedundantNames() {
- List result = Collections.emptyList();
- if (this.queueManager != null) {
- QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
+ List<String> result = Collections.emptyList();
+ if (queueManager != null) {
+ QueueManager.QueueConnections cons = queueManager.getAllConnections();
List<Connection> backupCons = cons.getBackups();
if (backupCons.size() > 0) {
- result = new ArrayList(backupCons.size());
- Iterator<Connection> it = backupCons.iterator();
- while (it.hasNext()) {
- Connection con = it.next();
+ result = new ArrayList<>(backupCons.size());
+ for (Connection con : backupCons) {
ServerLocation sl = con.getServer();
result.add(sl.getHostName() + sl.getPort());
}
@@ -1110,15 +1078,13 @@ public class PoolImpl implements InternalPool {
* redundant server. An empty list is returned if we have no redundant servers.
*/
public List<ServerLocation> getRedundants() {
- List result = Collections.emptyList();
- if (this.queueManager != null) {
- QueueManager.QueueConnections cons = this.queueManager.getAllConnections();
+ List<ServerLocation> result = Collections.emptyList();
+ if (queueManager != null) {
+ QueueManager.QueueConnections cons = queueManager.getAllConnections();
List<Connection> backupCons = cons.getBackups();
if (backupCons.size() > 0) {
- result = new ArrayList(backupCons.size());
- Iterator<Connection> it = backupCons.iterator();
- while (it.hasNext()) {
- Connection con = it.next();
+ result = new ArrayList<>(backupCons.size());
+ for (Connection con : backupCons) {
result.add(con.getServer());
}
}
@@ -1152,7 +1118,7 @@ public class PoolImpl implements InternalPool {
* @since GemFire 5.7
*/
public int getAttachCount() {
- return this.attachCount.get();
+ return attachCount.get();
}
/**
@@ -1161,7 +1127,7 @@ public class PoolImpl implements InternalPool {
* @since GemFire 5.7
*/
public void attach() {
- this.attachCount.getAndIncrement();
+ attachCount.getAndIncrement();
}
/**
@@ -1171,17 +1137,15 @@ public class PoolImpl implements InternalPool {
*/
@Override
public void detach() {
- this.attachCount.getAndDecrement();
+ attachCount.getAndDecrement();
}
/**
* Returns a list of ServerLocation instances; one for each server we are currently connected to.
*/
public List<ServerLocation> getCurrentServers() {
- ArrayList result = new ArrayList();
- Map endpointMap = endpointManager.getEndpointMap();
- result.addAll(endpointMap.keySet());
- return result;
+ Map<ServerLocation, Endpoint> endpointMap = endpointManager.getEndpointMap();
+ return new ArrayList<>(endpointMap.keySet());
}
/**
@@ -1190,10 +1154,8 @@ public class PoolImpl implements InternalPool {
*/
public List<String> getCurrentServerNames() {
List<ServerLocation> servers = getCurrentServers();
- ArrayList<String> result = new ArrayList(servers.size());
- Iterator it = servers.iterator();
- while (it.hasNext()) {
- ServerLocation sl = (ServerLocation) it.next();
+ ArrayList<String> result = new ArrayList<>(servers.size());
+ for (ServerLocation sl : servers) {
String name = sl.getHostName() + sl.getPort();
result.add(name);
}
@@ -1225,14 +1187,13 @@ public class PoolImpl implements InternalPool {
logger.debug("PoolImpl - endpointsNetDownForDUnitTest");
setTEST_DURABLE_IS_NET_DOWN(true);
try {
- Thread.sleep(this.pingInterval * 2);
+ Thread.sleep(pingInterval * 2);
} catch (java.lang.InterruptedException ignore) {
// do nothing.
}
- Map endpoints = endpointManager.getEndpointMap();
- for (Iterator itr = endpoints.values().iterator(); itr.hasNext();) {
- Endpoint endpoint = (Endpoint) itr.next();
+ Map<ServerLocation, Endpoint> endpoints = endpointManager.getEndpointMap();
+ for (Endpoint endpoint : endpoints.values()) {
logger.debug("PoolImpl Simulating crash of endpoint {}", endpoint);
endpointManager.serverCrashed(endpoint);
}
@@ -1244,7 +1205,7 @@ public class PoolImpl implements InternalPool {
public void endpointsNetUpForDUnitTest() {
setTEST_DURABLE_IS_NET_DOWN(false);
try {
- Thread.sleep(this.pingInterval * 2);
+ Thread.sleep(pingInterval * 2);
} catch (java.lang.InterruptedException ignore) {
// do nothing.
}
@@ -1254,7 +1215,7 @@ public class PoolImpl implements InternalPool {
* test hook
*/
public int getInvalidateCount() {
- return ((QueueStateImpl) this.queueManager.getState()).getInvalidateCount();
+ return ((QueueStateImpl) queueManager.getState()).getInvalidateCount();
}
@Override
@@ -1332,7 +1293,7 @@ public class PoolImpl implements InternalPool {
* new connection.
*/
@MutableForTesting
- public static volatile boolean AFTER_PRIMARY_RECOVERED_CALLBACK_FLAG = false;
+ static volatile boolean AFTER_PRIMARY_RECOVERED_CALLBACK_FLAG = false;
public abstract static class PoolTask implements Runnable {
@@ -1427,7 +1388,7 @@ public class PoolImpl implements InternalPool {
}
public RegionService createAuthenticatedCacheView(Properties properties) {
- if (!this.multiuserSecureModeEnabled) {
+ if (!multiuserSecureModeEnabled) {
throw new UnsupportedOperationException(
"Operation not supported when multiuser-authentication is false.");
}
@@ -1439,16 +1400,16 @@ public class PoolImpl implements InternalPool {
for (Entry<Object, Object> entry : properties.entrySet()) {
props.setProperty((String) entry.getKey(), (String) entry.getValue());
}
- if (cache == null && dsys != null) {
- cache = dsys.getCache();
+ if (cache == null && distributedSystem != null) {
+ cache = distributedSystem.getCache();
if (cache == null) {
throw new IllegalStateException(
"Cache must be created before creating pool");
}
}
ProxyCache proxy = new ProxyCache(props, cache, this);
- synchronized (this.proxyCacheList) {
- this.proxyCacheList.add(proxy);
+ synchronized (proxyCacheList) {
+ proxyCacheList.add(proxy);
}
return proxy;
}
@@ -1464,8 +1425,8 @@ public class PoolImpl implements InternalPool {
if (cacheCriterion != null) {
return cacheCriterion.generateCancelledException(e);
}
- if (dsys != null) {
- cache = dsys.getCache();
+ if (distributedSystem != null) {
+ cache = distributedSystem.getCache();
if (cache == null) {
throw new IllegalStateException(
"Cache must be created before creating pool");
@@ -1482,7 +1443,7 @@ public class PoolImpl implements InternalPool {
@Override
public String getPoolOrCacheCancelInProgress() {
- String reason = null;
+ String reason;
try {
reason = getCancelCriterion().cancelInProgress();
if (reason != null) {
@@ -1524,8 +1485,8 @@ public class PoolImpl implements InternalPool {
return cache.keepDurableSubscriptionsAlive();
}
- public ArrayList<ProxyCache> getProxyCacheList() {
- return this.proxyCacheList;
+ ArrayList<ProxyCache> getProxyCacheList() {
+ return proxyCacheList;
}
/**
@@ -1564,15 +1525,15 @@ public class PoolImpl implements InternalPool {
}
private void authenticateOnAllServers(Op op) {
- if (this.multiuserSecureModeEnabled && ((AbstractOp) op).needsUserId()) {
+ if (multiuserSecureModeEnabled && ((AbstractOp) op).needsUserId()) {
UserAttributes userAttributes = UserAttributes.userAttributes.get();
if (userAttributes != null) {
ConcurrentHashMap<ServerLocation, Long> map = userAttributes.getServerToId();
- if (this.queueManager == null) {
+ if (queueManager == null) {
throw new SubscriptionNotEnabledException();
}
- Connection primary = this.queueManager.getAllConnectionsNoWait().getPrimary();
+ Connection primary = queueManager.getAllConnectionsNoWait().getPrimary();
if (primary != null && !map.containsKey(primary.getServer())) {
Long userId = (Long) AuthenticateUserOp.executeOn(primary.getServer(), this,
userAttributes.getCredentials());
@@ -1581,9 +1542,8 @@ public class PoolImpl implements InternalPool {
}
}
- List<Connection> backups = this.queueManager.getAllConnectionsNoWait().getBackups();
- for (int i = 0; i < backups.size(); i++) {
- Connection conn = backups.get(i);
+ List<Connection> backups = queueManager.getAllConnectionsNoWait().getBackups();
+ for (Connection conn : backups) {
if (!map.containsKey(conn.getServer())) {
Long userId = (Long) AuthenticateUserOp.executeOn(conn.getServer(), this,
userAttributes.getCredentials());
@@ -1600,20 +1560,20 @@ public class PoolImpl implements InternalPool {
}
public void setPendingEventCount(int count) {
- this.primaryQueueSize.set(count);
+ primaryQueueSize.set(count);
}
@Override
public int getPendingEventCount() {
- if (!isDurableClient() || this.queueManager == null) {
+ if (!isDurableClient() || queueManager == null) {
throw new IllegalStateException(
"Only durable clients should call getPendingEventCount()");
}
- if (this.readyForEventsCalled) {
+ if (readyForEventsCalled) {
throw new IllegalStateException(
"getPendingEventCount() should be called before invoking readyForEvents().");
}
- return this.primaryQueueSize.get();
+ return primaryQueueSize.get();
}
@Override
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PutOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PutOp.java
index 231780e..9997942 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PutOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PutOp.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal;
import java.io.ByteArrayInputStream;
@@ -32,7 +33,6 @@ import org.apache.geode.internal.cache.CachedDeserializable;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.tier.MessageType;
-import org.apache.geode.internal.cache.tier.sockets.ChunkedMessage;
import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.cache.versions.VersionTag;
@@ -72,12 +72,12 @@ public class PutOp {
if (server != null) {
try {
PoolImpl poolImpl = (PoolImpl) pool;
- boolean onlyUseExistingCnx = ((poolImpl.getMaxConnections() != -1
- && poolImpl.getConnectionCount() >= poolImpl.getMaxConnections()) ? true : false);
+ boolean onlyUseExistingCnx = (poolImpl.getMaxConnections() != -1
+ && poolImpl.getConnectionCount() >= poolImpl.getMaxConnections());
op.setAllowDuplicateMetadataRefresh(!onlyUseExistingCnx);
return pool.executeOn(new ServerLocation(server.getHostName(), server.getPort()), op,
true, onlyUseExistingCnx);
- } catch (AllConnectionsInUseException e) {
+ } catch (AllConnectionsInUseException ignored) {
} catch (ServerConnectivityException e) {
if (e instanceof ServerOperationException) {
throw e; // fixed 44656
@@ -166,11 +166,28 @@ public class PutOp {
public PutOpImpl(String regionName, Object key, Object value, byte[] deltaBytes,
EntryEventImpl event, Operation op, boolean requireOldValue, Object expectedOldValue,
Object callbackArg, boolean respondingToInvalidDelta, boolean prSingleHopEnabled) {
+ this(regionName, key, value, deltaBytes, event, op, requireOldValue, expectedOldValue,
+ callbackArg, respondingToInvalidDelta, respondingToInvalidDelta, prSingleHopEnabled);
+ }
+
+ PutOpImpl(Region region, Object key, Object value, byte[] deltaBytes,
+ EntryEventImpl event, Operation op, boolean requireOldValue, Object expectedOldValue,
+ Object callbackArg, boolean sendFullObj, boolean prSingleHopEnabled) {
+ this(region.getFullPath(), key, value, deltaBytes, event, op, requireOldValue,
+ expectedOldValue,
+ callbackArg, false, sendFullObj, prSingleHopEnabled);
+ this.region = (LocalRegion) region;
+ }
+
+ private PutOpImpl(String regionName, Object key, Object value, byte[] deltaBytes,
+ EntryEventImpl event, Operation op, boolean requireOldValue, Object expectedOldValue,
+ Object callbackArg, boolean respondingToInvalidDelta, boolean sendFullObj,
+ boolean prSingleHopEnabled) {
super(MessageType.PUT,
7 + (callbackArg != null ? 1 : 0) + (expectedOldValue != null ? 1 : 0));
final boolean isDebugEnabled = logger.isDebugEnabled();
if (isDebugEnabled) {
- logger.debug("PutOpImpl constructing(1) message for {}; operation={}", event.getEventId(),
+ logger.debug("PutOpImpl constructing message for {}; operation={}", event.getEventId(),
op);
}
this.key = key;
@@ -197,71 +214,10 @@ public class PutOp {
getMessage().setIsRetry();
}
// Add message part for sending either delta or full value
- if (!respondingToInvalidDelta && deltaBytes != null && op == Operation.UPDATE) {
- getMessage().addObjPart(Boolean.TRUE);
- getMessage().addBytesPart(deltaBytes);
- this.deltaSent = true;
- if (isDebugEnabled) {
- logger.debug("PutOp: Sending delta for key {}", this.key);
- }
- } else if (value instanceof CachedDeserializable) {
- CachedDeserializable cd = (CachedDeserializable) value;
- if (!cd.isSerialized()) {
- // it is a byte[]
- getMessage().addObjPart(Boolean.FALSE);
- getMessage().addObjPart(cd.getDeserializedForReading());
- } else {
- getMessage().addObjPart(Boolean.FALSE);
- Object cdValue = cd.getValue();
- if (cdValue instanceof byte[]) {
- getMessage().addRawPart((byte[]) cdValue, true);
- } else {
- getMessage().addObjPart(cdValue);
- }
- }
- } else {
- getMessage().addObjPart(Boolean.FALSE);
- getMessage().addObjPart(value);
- }
- getMessage().addBytesPart(event.getEventId().calcBytes());
- if (callbackArg != null) {
- getMessage().addObjPart(callbackArg);
- }
- }
-
- public PutOpImpl(Region region, Object key, Object value, byte[] deltaBytes,
- EntryEventImpl event, Operation op, boolean requireOldValue, Object expectedOldValue,
- Object callbackArg, boolean sendFullObj, boolean prSingleHopEnabled) {
- super(MessageType.PUT,
- 7 + (callbackArg != null ? 1 : 0) + (expectedOldValue != null ? 1 : 0));
- this.key = key;
- this.callbackArg = callbackArg;
- this.event = event;
- this.value = value;
- this.region = (LocalRegion) region;
- this.regionName = region.getFullPath();
- this.prSingleHopEnabled = prSingleHopEnabled;
- final boolean isDebugEnabled = logger.isDebugEnabled();
- if (isDebugEnabled) {
- logger.debug("PutOpImpl constructing message with operation={}", op);
- }
- getMessage().addStringPart(region.getFullPath());
- getMessage().addBytePart(op.ordinal);
- int flags = 0;
- if (requireOldValue)
- flags |= 0x01;
- if (expectedOldValue != null)
- flags |= 0x02;
- getMessage().addIntPart(flags);
- if (expectedOldValue != null) {
- getMessage().addObjPart(expectedOldValue);
- }
- getMessage().addStringOrObjPart(key);
- // Add message part for sending either delta or full value
if (!sendFullObj && deltaBytes != null && op == Operation.UPDATE) {
getMessage().addObjPart(Boolean.TRUE);
getMessage().addBytesPart(deltaBytes);
- this.deltaSent = true;
+ deltaSent = true;
if (isDebugEnabled) {
logger.debug("PutOp: Sending delta for key {}", this.key);
}
@@ -310,14 +266,14 @@ public class PutOp {
*/
@Override
protected Object processResponse(Message msg, Connection con) throws Exception {
- processAck(msg, "put", con);
+ processAck(msg, con);
if (prSingleHopEnabled) {
Part part = msg.getPart(0);
byte[] bytesReceived = part.getSerializedForm();
if (bytesReceived[0] != ClientMetadataService.INITIAL_VERSION
&& bytesReceived.length == ClientMetadataService.SIZE_BYTES_ARRAY_RECEIVED) {
- if (this.region != null) {
+ if (region != null) {
ClientMetadataService cms = region.getCache().getClientMetadataService();
byte myVersion =
cms.getMetaDataVersion(region, Operation.UPDATE, key, value, callbackArg);
@@ -342,10 +298,10 @@ public class PutOp {
// if the server has versioning we will attach it to the client's event
// here so it can be applied to the cache
if ((flags & HAS_VERSION_TAG) != 0) {
- VersionTag tag = (VersionTag) msg.getPart(partIdx++).getObject();
+ VersionTag tag = (VersionTag) msg.getPart(partIdx).getObject();
// we use the client's ID since we apparently don't track the server's ID in connections
tag.replaceNullIDs((InternalDistributedMember) con.getEndpoint().getMemberId());
- this.event.setVersionTag(tag);
+ event.setVersionTag(tag);
}
return oldValue;
}
@@ -356,36 +312,33 @@ public class PutOp {
* Process a response that contains an ack.
*
* @param msg the message containing the response
- * @param opName text describing this op
* @param con Connection on which this op is executing
* @throws Exception if response could not be processed or we received a response with a server
* exception.
* @since GemFire 6.1
*/
- private void processAck(Message msg, String opName, Connection con) throws Exception {
+ private void processAck(Message msg, Connection con) throws Exception {
final int msgType = msg.getMessageType();
// Update delta stats
- if (this.deltaSent && this.region != null) {
- this.region.getCachePerfStats().incDeltasSent();
+ if (deltaSent && region != null) {
+ region.getCachePerfStats().incDeltasSent();
}
- if (msgType == MessageType.REPLY) {
- return;
- } else {
+ if (msgType != MessageType.REPLY) {
Part part = msg.getPart(0);
if (msgType == MessageType.PUT_DELTA_ERROR) {
if (logger.isDebugEnabled()) {
logger.debug("PutOp: Sending full value as delta failed on server...");
}
- AbstractOp op = new PutOpImpl(this.regionName, this.key, this.value, null, this.event,
- Operation.CREATE, this.requireOldValue, this.expectedOldValue, this.callbackArg,
- true /* send full obj */, this.prSingleHopEnabled);
+ AbstractOp op = new PutOpImpl(regionName, key, value, null, event,
+ Operation.CREATE, requireOldValue, expectedOldValue, callbackArg,
+ true /* send full obj */, prSingleHopEnabled);
op.attempt(con);
- if (this.region != null) {
- this.region.getCachePerfStats().incDeltaFullValuesSent();
+ if (region != null) {
+ region.getCachePerfStats().incDeltaFullValuesSent();
}
} else if (msgType == MessageType.EXCEPTION) {
- String s = ": While performing a remote " + opName;
+ String s = ": While performing a remote " + "put";
throw new ServerOperationException(s, (Throwable) part.getObject());
// Get the exception toString part.
// This was added for c++ thin client and not used in java
@@ -423,40 +376,6 @@ public class PutOp {
return "PutOp:" + key;
}
- /**
- * Attempts to read a response to this operation by reading it from the given connection, and
- * returning it.
- *
- * @param cnx the connection to read the response from
- * @return the result of the operation or <code>null</code if the operation has no result.
- * @throws Exception if the execute failed
- */
- @Override
- protected Object attemptReadResponse(Connection cnx) throws Exception {
- Message msg = createResponseMessage();
- if (msg != null) {
- msg.setComms(cnx.getSocket(), cnx.getInputStream(), cnx.getOutputStream(),
- cnx.getCommBuffer(), cnx.getStats());
- if (msg instanceof ChunkedMessage) {
- try {
- return processResponse(msg, cnx);
- } finally {
- msg.unsetComms();
- processSecureBytes(cnx, msg);
- }
- } else {
- try {
- msg.receive();
- } finally {
- msg.unsetComms();
- processSecureBytes(cnx, msg);
- }
- return processResponse(msg, cnx);
- }
- } else {
- return null;
- }
- }
}
}
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl.java
index be75c5c..6c6117f 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl.java
@@ -12,6 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
+
package org.apache.geode.cache.client.internal.pooling;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -72,25 +73,25 @@ public class ConnectionManagerImpl implements ConnectionManager {
private final String poolName;
private final PoolStats poolStats;
- protected final long prefillRetry; // ms
+ private final long prefillRetry; // ms
private final AvailableConnectionManager availableConnectionManager =
new AvailableConnectionManager();
protected final ConnectionMap allConnectionsMap = new ConnectionMap();
private final EndpointManager endpointManager;
private final long idleTimeout; // make this an int
- protected final long idleTimeoutNanos;
- final int lifetimeTimeout;
- final long lifetimeTimeoutNanos;
+ private final long idleTimeoutNanos;
+ private final int lifetimeTimeout;
+ private final long lifetimeTimeoutNanos;
private final InternalLogWriter securityLogWriter;
protected final CancelCriterion cancelCriterion;
private final ConnectionAccounting connectionAccounting;
- protected ScheduledExecutorService backgroundProcessor;
- protected ScheduledExecutorService loadConditioningProcessor;
+ private ScheduledExecutorService backgroundProcessor;
+ private ScheduledExecutorService loadConditioningProcessor;
private ConnectionFactory connectionFactory;
- protected boolean haveIdleExpireConnectionsTask;
- protected final AtomicBoolean havePrefillTask = new AtomicBoolean(false);
+ private boolean haveIdleExpireConnectionsTask;
+ private final AtomicBoolean havePrefillTask = new AtomicBoolean(false);
private boolean keepAlive = false;
protected final AtomicBoolean shuttingDown = new AtomicBoolean(false);
private EndpointManager.EndpointListenerAdapter endpointListener;
@@ -145,12 +146,12 @@ public class ConnectionManagerImpl implements ConnectionManager {
"Min connections " + minConnections + " must be greater than or equals to 0");
}
- this.connectionFactory = factory;
+ connectionFactory = factory;
this.endpointManager = endpointManager;
- this.connectionAccounting = new ConnectionAccounting(minConnections,
+ connectionAccounting = new ConnectionAccounting(minConnections,
maxConnections == -1 ? Integer.MAX_VALUE : maxConnections);
this.lifetimeTimeout = addVarianceToInterval(lifetimeTimeout);
- this.lifetimeTimeoutNanos = MILLISECONDS.toNanos(this.lifetimeTimeout);
+ lifetimeTimeoutNanos = MILLISECONDS.toNanos(this.lifetimeTimeout);
if (this.lifetimeTimeout != -1) {
if (idleTimeout > this.lifetimeTimeout || idleTimeout == -1) {
// lifetimeTimeout takes precedence over longer idle timeouts
@@ -158,11 +159,11 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
this.idleTimeout = idleTimeout;
- this.idleTimeoutNanos = MILLISECONDS.toNanos(this.idleTimeout);
- this.securityLogWriter = securityLogger;
- this.prefillRetry = pingInterval;
+ idleTimeoutNanos = MILLISECONDS.toNanos(this.idleTimeout);
+ securityLogWriter = securityLogger;
+ prefillRetry = pingInterval;
this.cancelCriterion = cancelCriterion;
- this.endpointListener = new EndpointManager.EndpointListenerAdapter() {
+ endpointListener = new EndpointManager.EndpointListenerAdapter() {
@Override
public void endpointCrashed(Endpoint endpoint) {
invalidateServer(endpoint);
@@ -202,8 +203,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
/**
- * Always creates a connection and may cause {@link #connectionCount} to exceed
- * {@link #maxConnections}.
+ * Always creates a connection and may cause {@link ConnectionAccounting} to exceed maximum.
*/
private PooledConnection forceCreateConnection(ServerLocation serverLocation)
throws ServerRefusedConnectionException, ServerOperationException {
@@ -216,8 +216,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
/**
- * Always creates a connection and may cause {@link #connectionCount} to exceed
- * {@link #maxConnections}.
+ * Always creates a connection and may cause {@link ConnectionAccounting} to exceed maximum.
*/
private PooledConnection forceCreateConnection(Set<ServerLocation> excludedServers)
throws NoAvailableServersException, ServerOperationException {
@@ -235,11 +234,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
return true;
}
- if (timeout < System.nanoTime()) {
- return true;
- }
+ return timeout < System.nanoTime();
- return false;
}
private long beginConnectionWaitStatIfNotStarted(final long waitStart) {
@@ -297,7 +293,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
endConnectionWaitStatIfStarted(waitStart);
}
- this.cancelCriterion.checkCancelInProgress(null);
+ cancelCriterion.checkCancelInProgress(null);
throw new AllConnectionsInUseException();
}
@@ -353,7 +349,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
protected String getPoolName() {
- return this.poolName;
+ return poolName;
}
private PooledConnection addConnection(Connection conn) {
@@ -387,7 +383,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
- protected void invalidateServer(Endpoint endpoint) {
+ private void invalidateServer(Endpoint endpoint) {
Set<PooledConnection> badConnections = allConnectionsMap.removeEndpoint(endpoint);
if (badConnections == null) {
return;
@@ -439,7 +435,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
/**
- * Destroys connection if and only if {@link #connectionCount} exceeds {@link #maxConnections}.
+ * Destroys connection if and only if {@link ConnectionAccounting} exceeds maximum.
*
* @return true if connection is destroyed, otherwise false.
*/
@@ -452,7 +448,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
if (localpool != null) {
durable = localpool.isDurableClient();
}
- connection.internalClose(durable || this.keepAlive);
+ connection.internalClose(durable || keepAlive);
} catch (Exception e) {
logger.warn(String.format("Error closing connection %s", connection), e);
}
@@ -471,7 +467,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
public void start(ScheduledExecutorService backgroundProcessor) {
this.backgroundProcessor = backgroundProcessor;
String name = "poolLoadConditioningMonitor-" + getPoolName();
- this.loadConditioningProcessor =
+ loadConditioningProcessor =
LoggingExecutors.newScheduledThreadPool(name, 1, false);
endpointManager.addListener(endpointListener);
@@ -492,9 +488,9 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
try {
- if (this.loadConditioningProcessor != null) {
- this.loadConditioningProcessor.shutdown();
- if (!this.loadConditioningProcessor.awaitTermination(PoolImpl.SHUTDOWN_TIMEOUT,
+ if (loadConditioningProcessor != null) {
+ loadConditioningProcessor.shutdown();
+ if (!loadConditioningProcessor.awaitTermination(PoolImpl.SHUTDOWN_TIMEOUT,
MILLISECONDS)) {
logger.warn("Timeout waiting for load conditioning tasks to complete");
}
@@ -512,15 +508,15 @@ public class ConnectionManagerImpl implements ConnectionManager {
@Override
public void emergencyClose() {
shuttingDown.set(true);
- if (this.loadConditioningProcessor != null) {
- this.loadConditioningProcessor.shutdown();
+ if (loadConditioningProcessor != null) {
+ loadConditioningProcessor.shutdown();
}
allConnectionsMap.emergencyClose();
}
- protected void startBackgroundExpiration() {
+ private void startBackgroundExpiration() {
if (idleTimeout >= 0) {
- synchronized (this.allConnectionsMap) {
+ synchronized (allConnectionsMap) {
if (!haveIdleExpireConnectionsTask) {
haveIdleExpireConnectionsTask = true;
try {
@@ -546,15 +542,15 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
- protected boolean prefill() {
+ private void prefill() {
try {
while (connectionAccounting.isUnderMinimum()) {
if (cancelCriterion.isCancelInProgress()) {
- return true;
+ return;
}
boolean createdConnection = prefillConnection();
if (!createdConnection) {
- return false;
+ return;
}
}
} catch (Throwable t) {
@@ -563,10 +559,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
t = t.getCause();
}
logInfo("Error prefilling connections", t);
- return false;
}
- return true;
}
@Override
@@ -575,7 +569,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
protected PoolStats getPoolStats() {
- return this.poolStats;
+ return poolStats;
}
private boolean prefillConnection() {
@@ -683,21 +677,20 @@ public class ConnectionManagerImpl implements ConnectionManager {
/**
* Offer the replacement "con" to any cnx currently connected to "currentServer".
*
- * @return true if someone takes our offer; false if not
*/
- private boolean offerReplacementConnection(Connection con, ServerLocation currentServer) {
+ private void offerReplacementConnection(Connection con, ServerLocation currentServer) {
boolean retry;
do {
retry = false;
- PooledConnection target = this.allConnectionsMap.findReplacementTarget(currentServer);
+ PooledConnection target = allConnectionsMap.findReplacementTarget(currentServer);
if (target != null) {
final Endpoint targetEP = target.getEndpoint();
boolean interrupted = false;
try {
if (target.switchConnection(con)) {
getPoolStats().incLoadConditioningDisconnect();
- this.allConnectionsMap.addReplacedCnx(target, targetEP);
- return true;
+ allConnectionsMap.addReplacedCnx(target, targetEP);
+ return;
} else {
retry = true;
}
@@ -715,7 +708,6 @@ public class ConnectionManagerImpl implements ConnectionManager {
} while (retry);
getPoolStats().incLoadConditioningReplaceTimeouts();
con.destroy();
- return false;
}
/**
@@ -725,12 +717,10 @@ public class ConnectionManagerImpl implements ConnectionManager {
* lifetime must not begin until it actually replaces the existing one.
*
* @param currentServer the server the candidate connection is connected to
- * @param idlePossible true if we have more cnxs than minPoolSize
* @return true if caller should recheck for expired lifetimes; false if a background check was
* scheduled or no expirations are possible.
*/
- private boolean createLifetimeReplacementConnection(ServerLocation currentServer,
- boolean idlePossible) {
+ private boolean createLifetimeReplacementConnection(ServerLocation currentServer) {
HashSet<ServerLocation> excludedServers = new HashSet<>();
while (true) {
ServerLocation sl = connectionFactory.findBestServer(currentServer, excludedServers);
@@ -743,7 +733,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
if (!allConnectionsMap.hasExpiredCnxToServer(currentServer)) {
break;
}
- Connection con = null;
+ Connection con;
try {
con = connectionFactory.createClientToServerConnection(sl, false);
if (con != null) {
@@ -758,11 +748,9 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
} catch (GemFireSecurityException e) {
securityLogWriter.warning(
- String.format("Security exception connecting to server '%s': %s",
- new Object[] {sl, e}));
+ String.format("Security exception connecting to server '%s': %s", sl, e));
} catch (ServerRefusedConnectionException srce) {
- logger.warn("Server '{}' refused new connection: {}",
- new Object[] {sl, srce});
+ logger.warn("Server '{}' refused new connection: {}", sl, srce.getMessage());
}
excludedServers.add(sl);
}
@@ -775,16 +763,16 @@ public class ConnectionManagerImpl implements ConnectionManager {
private boolean haveLifetimeExpireConnectionsTask;
volatile boolean closing;
- public synchronized boolean isIdleExpirePossible() {
- return this.allConnections.size() > connectionAccounting.getMinimum();
+ synchronized boolean isIdleExpirePossible() {
+ return allConnections.size() > connectionAccounting.getMinimum();
}
@Override
public synchronized String toString() {
final long now = System.nanoTime();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("<");
- for (Iterator it = this.allConnections.iterator(); it.hasNext();) {
+ for (Iterator it = allConnections.iterator(); it.hasNext();) {
PooledConnection pc = (PooledConnection) it.next();
sb.append(pc.getServer());
if (pc.shouldDestroy()) {
@@ -802,15 +790,15 @@ public class ConnectionManagerImpl implements ConnectionManager {
return sb.toString();
}
- public synchronized void addConnection(PooledConnection connection) {
- if (this.closing) {
+ synchronized void addConnection(PooledConnection connection) {
+ if (closing) {
throw new CacheClosedException("This pool is closing");
}
getPoolStats().incPoolConnections(1);
// we want the smallest birthDate (e.g. oldest cnx) at the front of the list
- this.allConnections.add(connection);
+ allConnections.add(connection);
addToEndpointMap(connection);
@@ -821,32 +809,30 @@ public class ConnectionManagerImpl implements ConnectionManager {
if (checkForReschedule(true)) {
// something has already expired so start processing with no delay
startBackgroundLifetimeExpiration(0);
- } else {
- // either no possible lifetime expires or we scheduled one
}
}
}
- public synchronized void addReplacedCnx(PooledConnection con, Endpoint oldEndpoint) {
- if (this.closing) {
+ synchronized void addReplacedCnx(PooledConnection con, Endpoint oldEndpoint) {
+ if (closing) {
throw new CacheClosedException("This pool is closing");
}
- if (this.allConnections.remove(con)) {
+ if (allConnections.remove(con)) {
// otherwise someone else has removed it and closed it
removeFromEndpointMap(oldEndpoint, con);
addToEndpointMap(con);
- this.allConnections.add(con);
+ allConnections.add(con);
if (isIdleExpirePossible()) {
startBackgroundExpiration();
}
}
}
- public synchronized Set<PooledConnection> removeEndpoint(Endpoint endpoint) {
- final Set<PooledConnection> endpointConnections = this.map.remove(endpoint);
+ synchronized Set<PooledConnection> removeEndpoint(Endpoint endpoint) {
+ final Set<PooledConnection> endpointConnections = map.remove(endpoint);
if (endpointConnections != null) {
int count = 0;
- for (Iterator<PooledConnection> it = this.allConnections.iterator(); it.hasNext();) {
+ for (Iterator<PooledConnection> it = allConnections.iterator(); it.hasNext();) {
if (endpointConnections.contains(it.next())) {
count++;
it.remove();
@@ -859,8 +845,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
return endpointConnections;
}
- public synchronized boolean removeConnection(PooledConnection connection) {
- boolean result = this.allConnections.remove(connection);
+ synchronized boolean removeConnection(PooledConnection connection) {
+ boolean result = allConnections.remove(connection);
if (result) {
getPoolStats().incPoolConnections(-1);
}
@@ -870,11 +856,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
private synchronized void addToEndpointMap(PooledConnection connection) {
- Set<PooledConnection> endpointConnections = map.get(connection.getEndpoint());
- if (endpointConnections == null) {
- endpointConnections = new HashSet<>();
- map.put(connection.getEndpoint(), endpointConnections);
- }
+ Set<PooledConnection> endpointConnections =
+ map.computeIfAbsent(connection.getEndpoint(), k -> new HashSet<>());
endpointConnections.add(connection);
}
@@ -884,11 +867,11 @@ public class ConnectionManagerImpl implements ConnectionManager {
private synchronized void removeFromEndpointMap(Endpoint endpoint,
PooledConnection connection) {
- Set<PooledConnection> endpointConnections = this.map.get(endpoint);
+ Set<PooledConnection> endpointConnections = map.get(endpoint);
if (endpointConnections != null) {
endpointConnections.remove(connection);
if (endpointConnections.size() == 0) {
- this.map.remove(endpoint);
+ map.remove(endpoint);
}
}
}
@@ -931,8 +914,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
public synchronized void emergencyClose() {
closing = true;
map.clear();
- while (!this.allConnections.isEmpty()) {
- PooledConnection pc = (PooledConnection) this.allConnections.remove(0);
+ while (!allConnections.isEmpty()) {
+ PooledConnection pc = allConnections.remove(0);
pc.emergencyClose();
}
}
@@ -943,7 +926,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
*
* @return null if a target could not be found
*/
- public synchronized PooledConnection findReplacementTarget(ServerLocation currentServer) {
+ synchronized PooledConnection findReplacementTarget(ServerLocation currentServer) {
final long now = System.nanoTime();
for (PooledConnection pc : allConnections) {
if (currentServer.equals(pc.getServer())) {
@@ -960,13 +943,12 @@ public class ConnectionManagerImpl implements ConnectionManager {
* Return true if we have a connection to the currentServer whose lifetime has expired.
* Otherwise return false;
*/
- public synchronized boolean hasExpiredCnxToServer(ServerLocation currentServer) {
- if (!this.allConnections.isEmpty()) {
+ synchronized boolean hasExpiredCnxToServer(ServerLocation currentServer) {
+ if (!allConnections.isEmpty()) {
final long now = System.nanoTime();
for (PooledConnection pc : allConnections) {
if (pc.shouldDestroy()) {
// this con has already been destroyed so ignore it
- continue;
} else if (currentServer.equals(pc.getServer())) {
{
long life = pc.remainingLife(now, lifetimeTimeoutNanos);
@@ -984,8 +966,8 @@ public class ConnectionManagerImpl implements ConnectionManager {
* Returns true if caller should recheck for expired lifetimes Returns false if a background
* check was scheduled or no expirations are possible.
*/
- public synchronized boolean checkForReschedule(boolean rescheduleOk) {
- if (!this.allConnections.isEmpty()) {
+ synchronized boolean checkForReschedule(boolean rescheduleOk) {
+ if (!allConnections.isEmpty()) {
final long now = System.nanoTime();
for (PooledConnection pc : allConnections) {
if (pc.hasIdleExpired(now, idleTimeoutNanos)) {
@@ -1015,10 +997,10 @@ public class ConnectionManagerImpl implements ConnectionManager {
/**
* Extend the life of the first expired connection to sl.
*/
- public synchronized void extendLifeOfCnxToServer(ServerLocation sl) {
- if (!this.allConnections.isEmpty()) {
+ synchronized void extendLifeOfCnxToServer(ServerLocation sl) {
+ if (!allConnections.isEmpty()) {
final long now = System.nanoTime();
- for (Iterator<PooledConnection> it = this.allConnections.iterator(); it.hasNext();) {
+ for (Iterator<PooledConnection> it = allConnections.iterator(); it.hasNext();) {
PooledConnection pc = it.next();
if (pc.remainingLife(now, lifetimeTimeoutNanos) > 0) {
// no more connections whose lifetime could have expired
@@ -1033,7 +1015,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
it.remove();
pc.setBirthDate(now);
getPoolStats().incLoadConditioningExtensions();
- this.allConnections.add(pc);
+ allConnections.add(pc);
// break so we only do this to the oldest connection
break;
}
@@ -1041,9 +1023,9 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
- public synchronized void startBackgroundLifetimeExpiration(long delay) {
- if (!this.haveLifetimeExpireConnectionsTask) {
- this.haveLifetimeExpireConnectionsTask = true;
+ synchronized void startBackgroundLifetimeExpiration(long delay) {
+ if (!haveLifetimeExpireConnectionsTask) {
+ haveLifetimeExpireConnectionsTask = true;
try {
LifetimeExpireConnectionsTask task = new LifetimeExpireConnectionsTask();
loadConditioningProcessor.schedule(task, delay, TimeUnit.NANOSECONDS);
@@ -1053,9 +1035,9 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
- public void expireIdleConnections() {
+ void expireIdleConnections() {
int expireCount = 0;
- List<PooledConnection> toClose = null;
+ List<PooledConnection> toClose;
synchronized (this) {
haveIdleExpireConnectionsTask = false;
if (shuttingDown.get()) {
@@ -1131,10 +1113,10 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
- public void checkLifetimes() {
+ void checkLifetimes() {
boolean done;
synchronized (this) {
- this.haveLifetimeExpireConnectionsTask = false;
+ haveLifetimeExpireConnectionsTask = false;
if (shuttingDown.get()) {
return;
}
@@ -1143,7 +1125,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
getPoolStats().incLoadConditioningCheck();
long firstLife = -1;
ServerLocation candidate = null;
- boolean idlePossible = true;
+ boolean idlePossible;
synchronized (this) {
if (shuttingDown.get()) {
@@ -1154,26 +1136,25 @@ public class ConnectionManagerImpl implements ConnectionManager {
long now = System.nanoTime();
long life = 0;
idlePossible = isIdleExpirePossible();
- for (Iterator<PooledConnection> it = this.allConnections.iterator(); it.hasNext()
+ for (Iterator<PooledConnection> it = allConnections.iterator(); it.hasNext()
&& life <= 0
&& (candidate == null);) {
PooledConnection pc = it.next();
// skip over idle expired and destroyed
life = pc.remainingLife(now, lifetimeTimeoutNanos);
if (life <= 0) {
- boolean idleTimedOut =
- idlePossible ? pc.hasIdleExpired(now, idleTimeoutNanos) : false;
+ boolean idleTimedOut = idlePossible && pc.hasIdleExpired(now, idleTimeoutNanos);
boolean destroyed = pc.shouldDestroy();
if (!idleTimedOut && !destroyed) {
candidate = pc.getServer();
}
- } else if (firstLife == -1) {
+ } else {
firstLife = life;
}
}
}
if (candidate != null) {
- done = !createLifetimeReplacementConnection(candidate, idlePossible);
+ done = !createLifetimeReplacementConnection(candidate);
} else {
if (firstLife >= 0) {
// reschedule
@@ -1200,24 +1181,24 @@ public class ConnectionManagerImpl implements ConnectionManager {
}
}
- private static class ClosedPoolConnectionList extends ArrayList {
+ private static class ClosedPoolConnectionList extends ArrayList<PooledConnection> {
@Override
- public Object set(int index, Object element) {
+ public PooledConnection set(int index, PooledConnection element) {
throw new CacheClosedException("This pool has been closed");
}
@Override
- public boolean add(Object element) {
+ public boolean add(PooledConnection element) {
throw new CacheClosedException("This pool has been closed");
}
@Override
- public void add(int index, Object element) {
+ public void add(int index, PooledConnection element) {
throw new CacheClosedException("This pool has been closed");
}
@Override
- public Object remove(int index) {
+ public PooledConnection remove(int index) {
throw new CacheClosedException("This pool has been closed");
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
index 6715674..323020c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
@@ -12,6 +12,7 @@
* 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;
@@ -72,7 +73,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (socketConnectTimeout <= -1) {
throw new IllegalArgumentException("socketConnectTimeout must be greater than -1");
}
- this.attributes.socketConnectTimeout = socketConnectTimeout;
+ attributes.socketConnectTimeout = socketConnectTimeout;
return this;
}
@@ -81,7 +82,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (connectionTimeout <= 0) {
throw new IllegalArgumentException("connectionTimeout must be greater than zero");
}
- this.attributes.connectionTimeout = connectionTimeout;
+ attributes.connectionTimeout = connectionTimeout;
return this;
}
@@ -90,7 +91,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (connectionLifetime < -1) {
throw new IllegalArgumentException("connectionLifetime must be greater than or equal to -1");
}
- this.attributes.connectionLifetime = connectionLifetime;
+ attributes.connectionLifetime = connectionLifetime;
return this;
}
@@ -99,7 +100,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (bufferSize <= 0) {
throw new IllegalArgumentException("socketBufferSize must be greater than zero");
}
- this.attributes.socketBufferSize = bufferSize;
+ attributes.socketBufferSize = bufferSize;
return this;
}
@@ -107,7 +108,7 @@ public class PoolFactoryImpl implements PoolFactory {
@Deprecated
public PoolFactory setThreadLocalConnections(boolean threadLocalConnections) {
logger.warn("Use of PoolFactory.setThreadLocalConnections is deprecated and ignored.");
- this.attributes.threadLocalConnections = threadLocalConnections;
+ attributes.threadLocalConnections = threadLocalConnections;
return this;
}
@@ -116,13 +117,13 @@ public class PoolFactoryImpl implements PoolFactory {
if (idleTimout < -1) {
throw new IllegalArgumentException("idleTimeout must be greater than or equal to -1");
}
- this.attributes.idleTimeout = idleTimout;
+ attributes.idleTimeout = idleTimout;
return this;
}
@Override
public PoolFactory setMaxConnections(int maxConnections) {
- if (maxConnections < this.attributes.minConnections && maxConnections != -1) {
+ if (maxConnections < attributes.minConnections && maxConnections != -1) {
throw new IllegalArgumentException(
"maxConnections must be greater than or equal to minConnections ("
+ attributes.minConnections + ")");
@@ -131,7 +132,7 @@ public class PoolFactoryImpl implements PoolFactory {
throw new IllegalArgumentException(
"maxConnections must be greater than 0, or set to -1 (no max)");
}
- this.attributes.maxConnections = maxConnections;
+ attributes.maxConnections = maxConnections;
return this;
}
@@ -144,7 +145,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (minConnections < 0) {
throw new IllegalArgumentException("must be greater than or equal to 0");
}
- this.attributes.minConnections = minConnections;
+ attributes.minConnections = minConnections;
return this;
}
@@ -153,7 +154,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (pingInterval <= 0) {
throw new IllegalArgumentException("pingInterval must be greater than zero");
}
- this.attributes.pingInterval = pingInterval;
+ attributes.pingInterval = pingInterval;
return this;
}
@@ -162,7 +163,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (statisticInterval < -1) {
throw new IllegalArgumentException("statisticInterval must be greater than or equal to -1");
}
- this.attributes.statisticInterval = statisticInterval;
+ attributes.statisticInterval = statisticInterval;
return this;
}
@@ -171,7 +172,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (retryAttempts < -1) {
throw new IllegalArgumentException("retryAttempts must be greater than or equal to -1");
}
- this.attributes.retryAttempts = retryAttempts;
+ attributes.retryAttempts = retryAttempts;
return this;
}
@@ -180,7 +181,7 @@ public class PoolFactoryImpl implements PoolFactory {
if (timeout < 0) {
throw new IllegalArgumentException("readTimeout must be greater than or equal to zero");
}
- this.attributes.readTimeout = timeout;
+ attributes.readTimeout = timeout;
return this;
}
@@ -189,35 +190,35 @@ public class PoolFactoryImpl implements PoolFactory {
if (group == null) {
group = DEFAULT_SERVER_GROUP;
}
- this.attributes.serverGroup = group;
+ attributes.serverGroup = group;
return this;
}
@Override
public PoolFactory setSubscriptionEnabled(boolean enabled) {
- this.attributes.queueEnabled = enabled;
+ attributes.queueEnabled = enabled;
return this;
}
@Override
public PoolFactory setPRSingleHopEnabled(boolean enabled) {
- this.attributes.prSingleHopEnabled = enabled;
+ attributes.prSingleHopEnabled = enabled;
return this;
}
@Override
public PoolFactory setMultiuserAuthentication(boolean enabled) {
- this.attributes.multiuserSecureModeEnabled = enabled;
+ attributes.multiuserSecureModeEnabled = enabled;
return this;
}
public PoolFactory setStartDisabled(boolean disable) {
- this.attributes.startDisabled = disable;
+ attributes.startDisabled = disable;
return this;
}
public PoolFactory setLocatorDiscoveryCallback(LocatorDiscoveryCallback callback) {
- this.attributes.locatorCallback = callback;
+ attributes.locatorCallback = callback;
return this;
}
@@ -227,7 +228,7 @@ public class PoolFactoryImpl implements PoolFactory {
throw new IllegalArgumentException(
"queueRedundancyLevel must be greater than or equal to -1");
}
- this.attributes.queueRedundancyLevel = redundancyLevel;
+ attributes.queueRedundancyLevel = redundancyLevel;
return this;
}
@@ -236,13 +237,13 @@ public class PoolFactoryImpl implements PoolFactory {
if (messageTrackingTimeout <= 0) {
throw new IllegalArgumentException("queueMessageTrackingTimeout must be greater than zero");
}
- this.attributes.queueMessageTrackingTimeout = messageTrackingTimeout;
+ attributes.queueMessageTrackingTimeout = messageTrackingTimeout;
return this;
}
@Override
public PoolFactory setSubscriptionTimeoutMultiplier(int multiplier) {
- this.attributes.subscriptionTimeoutMultipler = multiplier;
+ attributes.subscriptionTimeoutMultipler = multiplier;
return this;
}
@@ -251,7 +252,7 @@ public class PoolFactoryImpl implements PoolFactory {
throw new IllegalArgumentException("port must be greater than 0 but was " + port);
// the rest of the port validation is done by InetSocketAddress
}
- InetSocketAddress sockAddr = null;
+ InetSocketAddress sockAddr;
try {
InetAddress hostAddr = InetAddress.getByName(host);
sockAddr = new InetSocketAddress(hostAddr, port);
@@ -273,39 +274,39 @@ public class PoolFactoryImpl implements PoolFactory {
if (ackInterval <= 0) {
throw new IllegalArgumentException("ackInterval must be greater than 0");
}
- this.attributes.queueAckInterval = ackInterval;
+ attributes.queueAckInterval = ackInterval;
return this;
}
@Override
public PoolFactory addLocator(String host, int port) {
- if (this.attributes.servers.size() > 0) {
+ if (attributes.servers.size() > 0) {
throw new IllegalStateException(
"A server has already been added. You can only add locators or servers; not both.");
}
InetSocketAddress isa = getInetSocketAddress(host, port);
- this.attributes.locators.add(isa);
+ attributes.locators.add(isa);
locatorAddresses.add(new HostAddress(isa, host));
return this;
}
@Override
public PoolFactory addServer(String host, int port) {
- if (this.attributes.locators.size() > 0) {
+ if (attributes.locators.size() > 0) {
throw new IllegalStateException(
"A locator has already been added. You can only add locators or servers; not both.");
}
- this.attributes.servers.add(getInetSocketAddress(host, port));
+ attributes.servers.add(getInetSocketAddress(host, port));
return this;
}
@Override
public PoolFactory reset() {
// preserve the startDisabled across resets
- boolean sd = this.attributes.startDisabled;
- this.attributes = new PoolAttributes();
- this.attributes.startDisabled = sd;
+ boolean sd = attributes.startDisabled;
+ attributes = new PoolAttributes();
+ attributes.startDisabled = sd;
return this;
}
@@ -336,12 +337,12 @@ public class PoolFactoryImpl implements PoolFactory {
for (InetSocketAddress inetSocketAddress : cp.getLocators()) {
addLocator(inetSocketAddress.getHostName(), inetSocketAddress.getPort());
}
- this.attributes.servers.addAll(cp.getServers());
+ attributes.servers.addAll(cp.getServers());
}
public void init(GatewaySender sender) {
- this.attributes.setGateway(true);
- this.attributes.setGatewaySender(sender);
+ attributes.setGateway(true);
+ attributes.setGatewaySender(sender);
setIdleTimeout(-1); // never time out
setLoadConditioningInterval(-1); // never time out
setMaxConnections(-1);
@@ -361,7 +362,7 @@ public class PoolFactoryImpl implements PoolFactory {
@Override
public Pool create(String name) throws CacheException {
InternalDistributedSystem distributedSystem = InternalDistributedSystem.getAnyInstance();
- InternalCache cache = GemFireCacheImpl.getInstance();
+ InternalCache cache = getInternalCache();
ThreadsMonitoring threadMonitoring = null;
if (cache != null) {
threadMonitoring = cache.getDistributionManager().getThreadMonitoring();
@@ -370,15 +371,20 @@ public class PoolFactoryImpl implements PoolFactory {
registry.creatingPool();
}
}
- return PoolImpl.create(this.pm, name, this.attributes, this.locatorAddresses, distributedSystem,
+ return PoolImpl.create(pm, name, attributes, locatorAddresses, distributedSystem,
cache, threadMonitoring);
}
+ @SuppressWarnings("deprecation")
+ private static GemFireCacheImpl getInternalCache() {
+ return GemFireCacheImpl.getInstance();
+ }
+
/**
* Needed by test framework.
*/
public PoolAttributes getPoolAttributes() {
- return this.attributes;
+ return attributes;
}
@Override
@@ -391,7 +397,7 @@ public class PoolFactoryImpl implements PoolFactory {
}
PoolFactoryImpl that = (PoolFactoryImpl) o;
return Objects.equals(attributes, that.attributes)
- && Objects.equals(new HashSet(locatorAddresses), new HashSet(that.locatorAddresses));
+ && Objects.equals(new HashSet<>(locatorAddresses), new HashSet<>(that.locatorAddresses));
}
@Override
@@ -406,9 +412,9 @@ public class PoolFactoryImpl implements PoolFactory {
private static final long serialVersionUID = 1L; // for findbugs
- public int socketConnectTimeout = DEFAULT_SOCKET_CONNECT_TIMEOUT;
- public int connectionTimeout = DEFAULT_FREE_CONNECTION_TIMEOUT;
- public int connectionLifetime = DEFAULT_LOAD_CONDITIONING_INTERVAL;
+ int socketConnectTimeout = DEFAULT_SOCKET_CONNECT_TIMEOUT;
+ int connectionTimeout = DEFAULT_FREE_CONNECTION_TIMEOUT;
+ int connectionLifetime = DEFAULT_LOAD_CONDITIONING_INTERVAL;
public int socketBufferSize = DEFAULT_SOCKET_BUFFER_SIZE;
@Deprecated
private boolean threadLocalConnections = DEFAULT_THREAD_LOCAL_CONNECTIONS;
@@ -419,16 +425,16 @@ public class PoolFactoryImpl implements PoolFactory {
public int retryAttempts = DEFAULT_RETRY_ATTEMPTS;
public long pingInterval = DEFAULT_PING_INTERVAL;
public int statisticInterval = DEFAULT_STATISTIC_INTERVAL;
- public boolean queueEnabled = DEFAULT_SUBSCRIPTION_ENABLED;
+ boolean queueEnabled = DEFAULT_SUBSCRIPTION_ENABLED;
public boolean prSingleHopEnabled = DEFAULT_PR_SINGLE_HOP_ENABLED;
- public int queueRedundancyLevel = DEFAULT_SUBSCRIPTION_REDUNDANCY;
- public int queueMessageTrackingTimeout = DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT;
- public int queueAckInterval = DEFAULT_SUBSCRIPTION_ACK_INTERVAL;
- public int subscriptionTimeoutMultipler = DEFAULT_SUBSCRIPTION_TIMEOUT_MULTIPLIER;
+ int queueRedundancyLevel = DEFAULT_SUBSCRIPTION_REDUNDANCY;
+ int queueMessageTrackingTimeout = DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT;
+ int queueAckInterval = DEFAULT_SUBSCRIPTION_ACK_INTERVAL;
+ int subscriptionTimeoutMultipler = DEFAULT_SUBSCRIPTION_TIMEOUT_MULTIPLIER;
public String serverGroup = DEFAULT_SERVER_GROUP;
- public boolean multiuserSecureModeEnabled = DEFAULT_MULTIUSER_AUTHENTICATION;
- public ArrayList/* <InetSocketAddress> */ locators = new ArrayList();
- public ArrayList/* <InetSocketAddress> */ servers = new ArrayList();
+ boolean multiuserSecureModeEnabled = DEFAULT_MULTIUSER_AUTHENTICATION;
+ public ArrayList<InetSocketAddress> locators = new ArrayList<>();
+ public ArrayList<InetSocketAddress> servers = new ArrayList<>();
public transient boolean startDisabled = false; // only used by junit tests
public transient LocatorDiscoveryCallback locatorCallback = null; // only used by tests
public GatewaySender gatewaySender = null;
@@ -439,22 +445,22 @@ public class PoolFactoryImpl implements PoolFactory {
@Override
public int getSocketConnectTimeout() {
- return this.socketConnectTimeout;
+ return socketConnectTimeout;
}
@Override
public int getFreeConnectionTimeout() {
- return this.connectionTimeout;
+ return connectionTimeout;
}
@Override
public int getLoadConditioningInterval() {
- return this.connectionLifetime;
+ return connectionLifetime;
}
@Override
public int getSocketBufferSize() {
- return this.socketBufferSize;
+ return socketBufferSize;
}
@Override
@@ -490,32 +496,32 @@ public class PoolFactoryImpl implements PoolFactory {
@Override
@Deprecated
public boolean getThreadLocalConnections() {
- return this.threadLocalConnections;
+ return threadLocalConnections;
}
@Override
public int getReadTimeout() {
- return this.readTimeout;
+ return readTimeout;
}
@Override
public boolean getSubscriptionEnabled() {
- return this.queueEnabled;
+ return queueEnabled;
}
@Override
public boolean getPRSingleHopEnabled() {
- return this.prSingleHopEnabled;
+ return prSingleHopEnabled;
}
@Override
public int getSubscriptionRedundancy() {
- return this.queueRedundancyLevel;
+ return queueRedundancyLevel;
}
@Override
public int getSubscriptionMessageTrackingTimeout() {
- return this.queueMessageTrackingTimeout;
+ return queueMessageTrackingTimeout;
}
@Override
@@ -525,47 +531,46 @@ public class PoolFactoryImpl implements PoolFactory {
@Override
public String getServerGroup() {
- return this.serverGroup;
+ return serverGroup;
}
public boolean isGateway() {
- return this.gateway;
+ return gateway;
}
public void setGateway(boolean v) {
- this.gateway = v;
+ gateway = v;
}
public void setGatewaySender(GatewaySender sender) {
- this.gatewaySender = sender;
+ gatewaySender = sender;
}
public GatewaySender getGatewaySender() {
- return this.gatewaySender;
+ return gatewaySender;
}
@Override
public boolean getMultiuserAuthentication() {
- return this.multiuserSecureModeEnabled;
+ return multiuserSecureModeEnabled;
}
public void setMultiuserSecureModeEnabled(boolean v) {
- this.multiuserSecureModeEnabled = v;
+ multiuserSecureModeEnabled = v;
}
@Override
public int getSubscriptionTimeoutMultiplier() {
- return this.subscriptionTimeoutMultipler;
+ return subscriptionTimeoutMultipler;
}
@Override
- public List/* <InetSocketAddress> */ getLocators() {
- if (this.locators.size() == 0 && this.servers.size() == 0) {
+ public List<InetSocketAddress> getLocators() {
+ if (locators.size() == 0 && servers.size() == 0) {
throw new IllegalStateException(
"At least one locator or server must be added before a connection pool can be created.");
}
- // needs to return a copy.
- return Collections.unmodifiableList(new ArrayList(this.locators));
+ return Collections.unmodifiableList(new ArrayList<>(locators));
}
@Override
@@ -574,13 +579,13 @@ public class PoolFactoryImpl implements PoolFactory {
}
@Override
- public List/* <InetSocketAddress> */ getServers() {
- if (this.locators.size() == 0 && this.servers.size() == 0) {
+ public List<InetSocketAddress> getServers() {
+ if (locators.size() == 0 && servers.size() == 0) {
throw new IllegalStateException(
"At least one locator or server must be added before a connection pool can be created.");
}
// needs to return a copy.
- return Collections.unmodifiableList(new ArrayList(this.servers));
+ return Collections.unmodifiableList(new ArrayList<>(servers));
}
@Override
@@ -616,48 +621,48 @@ public class PoolFactoryImpl implements PoolFactory {
@Override
public void toData(DataOutput out) throws IOException {
- DataSerializer.writePrimitiveInt(this.connectionTimeout, out);
- DataSerializer.writePrimitiveInt(this.connectionLifetime, out);
- DataSerializer.writePrimitiveInt(this.socketBufferSize, out);
- DataSerializer.writePrimitiveInt(this.readTimeout, out);
- DataSerializer.writePrimitiveInt(this.minConnections, out);
- DataSerializer.writePrimitiveInt(this.maxConnections, out);
- DataSerializer.writePrimitiveInt(this.retryAttempts, out);
- DataSerializer.writePrimitiveLong(this.idleTimeout, out);
- DataSerializer.writePrimitiveLong(this.pingInterval, out);
- DataSerializer.writePrimitiveInt(this.queueRedundancyLevel, out);
- DataSerializer.writePrimitiveInt(this.queueMessageTrackingTimeout, out);
- DataSerializer.writePrimitiveBoolean(this.threadLocalConnections, out);
- DataSerializer.writePrimitiveBoolean(this.queueEnabled, out);
- DataSerializer.writeString(this.serverGroup, out);
- DataSerializer.writeArrayList(this.locators, out);
- DataSerializer.writeArrayList(this.servers, out);
- DataSerializer.writePrimitiveInt(this.statisticInterval, out);
- DataSerializer.writePrimitiveBoolean(this.multiuserSecureModeEnabled, out);
- DataSerializer.writePrimitiveInt(this.socketConnectTimeout, out);
+ DataSerializer.writePrimitiveInt(connectionTimeout, out);
+ DataSerializer.writePrimitiveInt(connectionLifetime, out);
+ DataSerializer.writePrimitiveInt(socketBufferSize, out);
+ DataSerializer.writePrimitiveInt(readTimeout, out);
+ DataSerializer.writePrimitiveInt(minConnections, out);
+ DataSerializer.writePrimitiveInt(maxConnections, out);
+ DataSerializer.writePrimitiveInt(retryAttempts, out);
+ DataSerializer.writePrimitiveLong(idleTimeout, out);
+ DataSerializer.writePrimitiveLong(pingInterval, out);
+ DataSerializer.writePrimitiveInt(queueRedundancyLevel, out);
+ DataSerializer.writePrimitiveInt(queueMessageTrackingTimeout, out);
+ DataSerializer.writePrimitiveBoolean(threadLocalConnections, out);
+ DataSerializer.writePrimitiveBoolean(queueEnabled, out);
+ DataSerializer.writeString(serverGroup, out);
+ DataSerializer.writeArrayList(locators, out);
+ DataSerializer.writeArrayList(servers, out);
+ DataSerializer.writePrimitiveInt(statisticInterval, out);
+ DataSerializer.writePrimitiveBoolean(multiuserSecureModeEnabled, out);
+ DataSerializer.writePrimitiveInt(socketConnectTimeout, out);
}
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
- this.connectionTimeout = DataSerializer.readPrimitiveInt(in);
- this.connectionLifetime = DataSerializer.readPrimitiveInt(in);
- this.socketBufferSize = DataSerializer.readPrimitiveInt(in);
- this.readTimeout = DataSerializer.readPrimitiveInt(in);
- this.minConnections = DataSerializer.readPrimitiveInt(in);
- this.maxConnections = DataSerializer.readPrimitiveInt(in);
- this.retryAttempts = DataSerializer.readPrimitiveInt(in);
- this.idleTimeout = DataSerializer.readPrimitiveLong(in);
- this.pingInterval = DataSerializer.readPrimitiveLong(in);
- this.queueRedundancyLevel = DataSerializer.readPrimitiveInt(in);
- this.queueMessageTrackingTimeout = DataSerializer.readPrimitiveInt(in);
- this.threadLocalConnections = DataSerializer.readPrimitiveBoolean(in);
- this.queueEnabled = DataSerializer.readPrimitiveBoolean(in);
- this.serverGroup = DataSerializer.readString(in);
- this.locators = DataSerializer.readArrayList(in);
- this.servers = DataSerializer.readArrayList(in);
- this.statisticInterval = DataSerializer.readPrimitiveInt(in);
- this.multiuserSecureModeEnabled = DataSerializer.readPrimitiveBoolean(in);
- this.socketConnectTimeout = DataSerializer.readPrimitiveInt(in);
+ connectionTimeout = DataSerializer.readPrimitiveInt(in);
+ connectionLifetime = DataSerializer.readPrimitiveInt(in);
+ socketBufferSize = DataSerializer.readPrimitiveInt(in);
+ readTimeout = DataSerializer.readPrimitiveInt(in);
+ minConnections = DataSerializer.readPrimitiveInt(in);
+ maxConnections = DataSerializer.readPrimitiveInt(in);
+ retryAttempts = DataSerializer.readPrimitiveInt(in);
+ idleTimeout = DataSerializer.readPrimitiveLong(in);
+ pingInterval = DataSerializer.readPrimitiveLong(in);
+ queueRedundancyLevel = DataSerializer.readPrimitiveInt(in);
+ queueMessageTrackingTimeout = DataSerializer.readPrimitiveInt(in);
+ threadLocalConnections = DataSerializer.readPrimitiveBoolean(in);
+ queueEnabled = DataSerializer.readPrimitiveBoolean(in);
+ serverGroup = DataSerializer.readString(in);
+ locators = DataSerializer.readArrayList(in);
+ servers = DataSerializer.readArrayList(in);
+ statisticInterval = DataSerializer.readPrimitiveInt(in);
+ multiuserSecureModeEnabled = DataSerializer.readPrimitiveBoolean(in);
+ socketConnectTimeout = DataSerializer.readPrimitiveInt(in);
}
@Override
@@ -696,8 +701,8 @@ public class PoolFactoryImpl implements PoolFactory {
&& multiuserSecureModeEnabled == that.multiuserSecureModeEnabled
&& startDisabled == that.startDisabled && gateway == that.gateway
&& Objects.equals(serverGroup, that.serverGroup)
- && Objects.equals(new HashSet(locators), new HashSet(that.locators))
- && Objects.equals(new HashSet(servers), new HashSet(that.servers))
+ && Objects.equals(new HashSet<>(locators), new HashSet<>(that.locators))
+ && Objects.equals(new HashSet<>(servers), new HashSet<>(that.servers))
&& Objects.equals(locatorCallback, that.locatorCallback)
&& Objects.equals(gatewaySender, that.gatewaySender);
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
index 841e4ff..242c86f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PoolManagerImpl.java
@@ -76,14 +76,14 @@ public class PoolManagerImpl {
* listener. False if it is a fake manager used internally by the XML code.
*/
public PoolManagerImpl(boolean addListener) {
- this.normalManager = addListener;
+ normalManager = addListener;
}
/**
* Returns true if this is a normal manager; false if it is a fake one used for xml parsing.
*/
public boolean isNormal() {
- return this.normalManager;
+ return normalManager;
}
/**
@@ -104,7 +104,7 @@ public class PoolManagerImpl {
* @return the existing connection pool or <code>null</code> if it does not exist.
*/
public Pool find(String name) {
- return this.pools.get(name);
+ return pools.get(name);
}
/**
@@ -114,8 +114,7 @@ public class PoolManagerImpl {
// destroying connection pools
boolean foundClientPool = false;
synchronized (poolLock) {
- for (Iterator<Map.Entry<String, Pool>> itr = pools.entrySet().iterator(); itr.hasNext();) {
- Map.Entry<String, Pool> entry = itr.next();
+ for (Entry<String, Pool> entry : pools.entrySet()) {
PoolImpl pool = (PoolImpl) entry.getValue();
pool.basicDestroy(keepAlive);
foundClientPool = true;
@@ -133,8 +132,7 @@ public class PoolManagerImpl {
* @return a copy of the Pools Map
*/
public Map<String, Pool> getMap() {
- // debugStack("getMap: " + this.pools);
- return new HashMap<String, Pool>(this.pools);
+ return new HashMap<>(pools);
}
/**
@@ -143,8 +141,8 @@ public class PoolManagerImpl {
* @throws IllegalStateException if a pool with same name is already registered.
*/
public void register(Pool pool) {
- synchronized (this.poolLock) {
- Map<String, Pool> copy = new HashMap<String, Pool>(pools);
+ synchronized (poolLock) {
+ Map<String, Pool> copy = new HashMap<>(pools);
String name = pool.getName();
// debugStack("register pool=" + name);
Object old = copy.put(name, pool);
@@ -157,8 +155,8 @@ public class PoolManagerImpl {
// throw new IllegalStateException("Using SPECIAL_DURABLE system property"
// + " and more than one pool already exists in client.");
// }
- this.pools = Collections.unmodifiableMap(copy);
- this.itrForEmergencyClose = copy.entrySet().iterator();
+ pools = Collections.unmodifiableMap(copy);
+ itrForEmergencyClose = copy.entrySet().iterator();
}
}
@@ -168,16 +166,16 @@ public class PoolManagerImpl {
* @return true if pool unregistered from cache; false if someone else already did it
*/
public boolean unregister(Pool pool) {
- synchronized (this.poolLock) {
- Map<String, Pool> copy = new HashMap<String, Pool>(pools);
+ synchronized (poolLock) {
+ Map<String, Pool> copy = new HashMap<>(pools);
String name = pool.getName();
// debugStack("unregister pool=" + name);
Object rmPool = copy.remove(name);
if (rmPool == null || rmPool != pool) {
return false;
} else {
- this.pools = Collections.unmodifiableMap(copy);
- this.itrForEmergencyClose = copy.entrySet().iterator();
+ pools = Collections.unmodifiableMap(copy);
+ itrForEmergencyClose = copy.entrySet().iterator();
return true;
}
}
@@ -185,9 +183,7 @@ public class PoolManagerImpl {
@Override
public String toString() {
- StringBuffer result = new StringBuffer();
- result.append(super.toString()).append("-").append(this.normalManager ? "normal" : "xml");
- return result.toString();
+ return super.toString() + "-" + (normalManager ? "normal" : "xml");
}
/**
@@ -196,12 +192,12 @@ public class PoolManagerImpl {
public static void readyForEvents(InternalDistributedSystem system, boolean xmlPoolsOnly) {
boolean foundDurablePool = false;
Map<String, Pool> pools = PoolManager.getAll();
- for (Iterator<Pool> itr = pools.values().iterator(); itr.hasNext();) {
- PoolImpl p = (PoolImpl) itr.next();
+ for (Pool pool : pools.values()) {
+ PoolImpl p = (PoolImpl) pool;
if (p.isDurableClient()) {
// TODO - handle an exception and attempt on all pools?
foundDurablePool = true;
- if (!xmlPoolsOnly || p.getDeclaredInXML()) {
+ if (!xmlPoolsOnly) {
p.readyForEvents(system);
}
}
@@ -213,17 +209,13 @@ public class PoolManagerImpl {
}
public static void allPoolsRegisterInstantiator(Instantiator instantiator) {
- Instantiator[] instantiators = new Instantiator[1];
- instantiators[0] = instantiator;
- for (Iterator<Pool> itr = PoolManager.getAll().values().iterator(); itr.hasNext();) {
- PoolImpl next = (PoolImpl) itr.next();
+ Instantiator[] instantiators = new Instantiator[] {instantiator};
+ for (Pool pool : PoolManager.getAll().values()) {
+ PoolImpl next = (PoolImpl) pool;
try {
EventID eventId = InternalInstantiator.generateEventId();
- if (eventId == null) {
- // cache must not exist, do nothing
- } else {
- RegisterInstantiatorsOp.execute(next, instantiators,
- InternalInstantiator.generateEventId());
+ if (eventId != null) {
+ RegisterInstantiatorsOp.execute(next, instantiators, eventId);
}
} catch (RuntimeException e) {
logger.warn("Error registering instantiator on pool:", e);
@@ -232,16 +224,13 @@ public class PoolManagerImpl {
}
public static void allPoolsRegisterInstantiator(InstantiatorAttributesHolder holder) {
- InstantiatorAttributesHolder[] holders = new InstantiatorAttributesHolder[1];
- holders[0] = holder;
- for (Iterator<Pool> itr = PoolManager.getAll().values().iterator(); itr.hasNext();) {
- PoolImpl next = (PoolImpl) itr.next();
+ InstantiatorAttributesHolder[] holders = new InstantiatorAttributesHolder[] {holder};
+ for (Pool pool : PoolManager.getAll().values()) {
+ PoolImpl next = (PoolImpl) pool;
try {
EventID eventId = InternalInstantiator.generateEventId();
- if (eventId == null) {
- // cache must not exist, do nothing
- } else {
- RegisterInstantiatorsOp.execute(next, holders, InternalInstantiator.generateEventId());
+ if (eventId != null) {
+ RegisterInstantiatorsOp.execute(next, holders, eventId);
}
} catch (RuntimeException e) {
logger.warn("Error registering instantiator on pool:", e);
@@ -250,18 +239,15 @@ public class PoolManagerImpl {
}
public static void allPoolsRegisterDataSerializers(DataSerializer dataSerializer) {
- DataSerializer[] dataSerializers = new DataSerializer[1];
- dataSerializers[0] = dataSerializer;
- for (Iterator<Pool> itr = PoolManager.getAll().values().iterator(); itr.hasNext();) {
- PoolImpl next = (PoolImpl) itr.next();
+ DataSerializer[] dataSerializers = new DataSerializer[] {dataSerializer};
+ for (Pool pool : PoolManager.getAll().values()) {
+ PoolImpl next = (PoolImpl) pool;
try {
EventID eventId = (EventID) dataSerializer.getEventId();
if (eventId == null) {
eventId = InternalDataSerializer.generateEventId();
}
- if (eventId == null) {
- // cache must not exist, do nothing
- } else {
+ if (eventId != null) {
RegisterDataSerializersOp.execute(next, dataSerializers, eventId);
}
} catch (RuntimeException e) {
@@ -271,18 +257,15 @@ public class PoolManagerImpl {
}
public static void allPoolsRegisterDataSerializers(SerializerAttributesHolder holder) {
- SerializerAttributesHolder[] holders = new SerializerAttributesHolder[1];
- holders[0] = holder;
- for (Iterator<Pool> itr = PoolManager.getAll().values().iterator(); itr.hasNext();) {
- PoolImpl next = (PoolImpl) itr.next();
+ SerializerAttributesHolder[] holders = new SerializerAttributesHolder[] {holder};
+ for (Pool pool : PoolManager.getAll().values()) {
+ PoolImpl next = (PoolImpl) pool;
try {
- EventID eventId = (EventID) holder.getEventId();
+ EventID eventId = holder.getEventId();
if (eventId == null) {
eventId = InternalDataSerializer.generateEventId();
}
- if (eventId == null) {
- // cache must not exist, do nothing
- } else {
+ if (eventId != null) {
RegisterDataSerializersOp.execute(next, holders, eventId);
}
} catch (RuntimeException e) {
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/PoolType.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/PoolType.java
index 1de9446..b17aae8 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/PoolType.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/PoolType.java
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -106,9 +105,9 @@ public class PoolType {
@XmlElement(name = "server", namespace = "http://geode.apache.org/schema/cache")
protected List<Server> servers;
@XmlAttribute(name = "subscription-timeout-multiplier")
- protected String subscriptionTimeoutMultiplier;
+ private String subscriptionTimeoutMultiplier;
@XmlAttribute(name = "socket-connect-timeout")
- protected String socketConnectTimeout;
+ private String socketConnectTimeout;
@XmlAttribute(name = "free-connection-timeout")
protected String freeConnectionTimeout;
@XmlAttribute(name = "load-conditioning-interval")
@@ -134,7 +133,7 @@ public class PoolType {
@XmlAttribute(name = "subscription-enabled")
protected Boolean subscriptionEnabled;
@XmlAttribute(name = "subscription-message-tracking-timeout")
- protected String subscriptionMessageTrackingTimeout;
+ private String subscriptionMessageTrackingTimeout;
@XmlAttribute(name = "subscription-ack-interval")
protected String subscriptionAckInterval;
@XmlAttribute(name = "subscription-redundancy")
@@ -147,7 +146,7 @@ public class PoolType {
@XmlAttribute(name = "pr-single-hop-enabled")
protected Boolean prSingleHopEnabled;
@XmlAttribute(name = "multiuser-authentication")
- protected Boolean multiuserAuthentication;
+ private Boolean multiuserAuthentication;
/**
* Gets the value of the locator property.
@@ -174,9 +173,9 @@ public class PoolType {
*/
public List<Locator> getLocators() {
if (locators == null) {
- locators = new ArrayList<Locator>();
+ locators = new ArrayList<>();
}
- return this.locators;
+ return locators;
}
/**
@@ -204,9 +203,9 @@ public class PoolType {
*/
public List<Server> getServers() {
if (servers == null) {
- servers = new ArrayList<Server>();
+ servers = new ArrayList<>();
}
- return this.servers;
+ return servers;
}
/**
@@ -228,7 +227,7 @@ public class PoolType {
*
*/
public void setSubscriptionTimeoutMultiplier(String value) {
- this.subscriptionTimeoutMultiplier = value;
+ subscriptionTimeoutMultiplier = value;
}
/**
@@ -250,7 +249,7 @@ public class PoolType {
*
*/
public void setSocketConnectTimeout(String value) {
- this.socketConnectTimeout = value;
+ socketConnectTimeout = value;
}
/**
@@ -272,7 +271,7 @@ public class PoolType {
*
*/
public void setFreeConnectionTimeout(String value) {
- this.freeConnectionTimeout = value;
+ freeConnectionTimeout = value;
}
/**
@@ -294,7 +293,7 @@ public class PoolType {
*
*/
public void setLoadConditioningInterval(String value) {
- this.loadConditioningInterval = value;
+ loadConditioningInterval = value;
}
/**
@@ -316,7 +315,7 @@ public class PoolType {
*
*/
public void setMinConnections(String value) {
- this.minConnections = value;
+ minConnections = value;
}
/**
@@ -338,7 +337,7 @@ public class PoolType {
*
*/
public void setMaxConnections(String value) {
- this.maxConnections = value;
+ maxConnections = value;
}
/**
@@ -360,7 +359,7 @@ public class PoolType {
*
*/
public void setRetryAttempts(String value) {
- this.retryAttempts = value;
+ retryAttempts = value;
}
/**
@@ -382,7 +381,7 @@ public class PoolType {
*
*/
public void setIdleTimeout(String value) {
- this.idleTimeout = value;
+ idleTimeout = value;
}
/**
@@ -404,7 +403,7 @@ public class PoolType {
*
*/
public void setPingInterval(String value) {
- this.pingInterval = value;
+ pingInterval = value;
}
/**
@@ -426,7 +425,7 @@ public class PoolType {
*
*/
public void setName(String value) {
- this.name = value;
+ name = value;
}
/**
@@ -448,7 +447,7 @@ public class PoolType {
*
*/
public void setReadTimeout(String value) {
- this.readTimeout = value;
+ readTimeout = value;
}
/**
@@ -470,7 +469,7 @@ public class PoolType {
*
*/
public void setServerGroup(String value) {
- this.serverGroup = value;
+ serverGroup = value;
}
/**
@@ -492,7 +491,7 @@ public class PoolType {
*
*/
public void setSocketBufferSize(String value) {
- this.socketBufferSize = value;
+ socketBufferSize = value;
}
/**
@@ -514,7 +513,7 @@ public class PoolType {
*
*/
public void setSubscriptionEnabled(Boolean value) {
- this.subscriptionEnabled = value;
+ subscriptionEnabled = value;
}
/**
@@ -536,7 +535,7 @@ public class PoolType {
*
*/
public void setSubscriptionMessageTrackingTimeout(String value) {
- this.subscriptionMessageTrackingTimeout = value;
+ subscriptionMessageTrackingTimeout = value;
}
/**
@@ -558,7 +557,7 @@ public class PoolType {
*
*/
public void setSubscriptionAckInterval(String value) {
- this.subscriptionAckInterval = value;
+ subscriptionAckInterval = value;
}
/**
@@ -580,7 +579,7 @@ public class PoolType {
*
*/
public void setSubscriptionRedundancy(String value) {
- this.subscriptionRedundancy = value;
+ subscriptionRedundancy = value;
}
/**
@@ -602,7 +601,7 @@ public class PoolType {
*
*/
public void setStatisticInterval(String value) {
- this.statisticInterval = value;
+ statisticInterval = value;
}
/**
@@ -630,7 +629,7 @@ public class PoolType {
*/
@Deprecated
public void setThreadLocalConnections(Boolean value) {
- this.threadLocalConnections = value;
+ threadLocalConnections = value;
}
/**
@@ -652,7 +651,7 @@ public class PoolType {
*
*/
public void setPrSingleHopEnabled(Boolean value) {
- this.prSingleHopEnabled = value;
+ prSingleHopEnabled = value;
}
/**
@@ -674,7 +673,7 @@ public class PoolType {
*
*/
public void setMultiuserAuthentication(Boolean value) {
- this.multiuserAuthentication = value;
+ multiuserAuthentication = value;
}
@@ -726,7 +725,7 @@ public class PoolType {
*
*/
public void setHost(String value) {
- this.host = value;
+ host = value;
}
/**
@@ -748,7 +747,7 @@ public class PoolType {
*
*/
public void setPort(String value) {
- this.port = value;
+ port = value;
}
}
@@ -802,7 +801,7 @@ public class PoolType {
*
*/
public void setHost(String value) {
- this.host = value;
+ host = value;
}
/**
@@ -824,7 +823,7 @@ public class PoolType {
*
*/
public void setPort(String value) {
- this.port = value;
+ port = value;
}
}