geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject geode git commit: GEODE-2788: Add official Socket timeout parameter when connecting to servers/locators
Date Fri, 09 Jun 2017 23:10:05 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 8c41fd32c -> 61b1d0c48


GEODE-2788: Add official Socket timeout parameter when connecting to servers/locators

When connecting from the client to the servers/locators, if the servers/locators is not started,
the connection can not be established and a Socket timeout occurs.
This timeout value is 59 seconds by default. This timeout value is too long. This timeout
value can be changed by specifying the unofficial parameter "gemfire.PoolImpl.HANDSHAKE_TIMEOUT"
in java system property, but I corresponded so that it can be specified by official parameters.
The official parameters are specified by the attribute of Pool.(default:59000 ms)

For example, cache.xml like this:
<pool name="MyPool" socket-connect-timeout="15000">
  <locator host="localhost" port="10334" />
</pool>

API like this:
ClientCacheFactory().addPoolLocator("localhost", 10334).setPoolSocketConnecTimeout(15000);
 or
PoolManager.createFactory().addServer("localhost", 40404).setSocketConnectTimeout(15000);


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/61b1d0c4
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/61b1d0c4
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/61b1d0c4

Branch: refs/heads/develop
Commit: 61b1d0c48f9ddd7e77367e2039a9c03900168823
Parents: 8c41fd3
Author: masaki.yamakawa <masaki.yamakawa@ulsystems.co.jp>
Authored: Sun Apr 23 00:44:08 2017 +0900
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Fri Jun 9 16:04:17 2017 -0700

----------------------------------------------------------------------
 .../geode/cache/client/ClientCacheFactory.java  | 15 +++++++++++
 .../org/apache/geode/cache/client/Pool.java     |  7 ++++++
 .../apache/geode/cache/client/PoolFactory.java  | 20 +++++++++++++++
 .../geode/cache/client/internal/PoolImpl.java   | 21 ++++++++++------
 .../geode/internal/cache/PoolFactoryImpl.java   | 16 ++++++++++++
 .../geode/internal/cache/xmlcache/CacheXml.java |  1 +
 .../cache/xmlcache/CacheXmlGenerator.java       |  6 +++++
 .../internal/cache/xmlcache/CacheXmlParser.java |  4 +++
 .../geode.apache.org/schema/cache/cache-1.0.xsd |  3 ++-
 .../client/ClientCacheFactoryJUnitTest.java     | 26 ++++++++++++++++----
 .../AutoConnectionSourceImplJUnitTest.java      |  4 +++
 .../internal/ConnectionPoolImplJUnitTest.java   |  6 ++++-
 .../client/internal/QueueManagerJUnitTest.java  |  4 +++
 .../ClientCacheFactoryJUnitTest_single_pool.xml | 11 +++++----
 .../sanctionedDataSerializables.txt             |  4 +--
 15 files changed, 127 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/cache/client/ClientCacheFactory.java
----------------------------------------------------------------------
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 4839a7c..8f48862 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
@@ -274,6 +274,21 @@ public class ClientCacheFactory {
   }
 
   /**
+   * Sets the socket connect timeout for this pool. The number of milli seconds specified
as socket
+   * timeout when the client connects to the servers/locators. A timeout of zero is interpreted
as
+   * an infinite timeout. The connection will then block until established or an error occurs.
+   *
+   * @param socketConnectTimeout timeout in milliseconds when the client connects to the
servers
+   * @return a reference to <code>this</code>
+   * @throws IllegalArgumentException if <code>socketConnectTimeout</code> is
less than or equal to
+   *         <code>-1</code>.
+   */
+  public ClientCacheFactory setPoolSocketConnectTimeout(int socketConnectTimeout) {
+    getPoolFactory().setSocketConnectTimeout(socketConnectTimeout);
+    return this;
+  }
+
+  /**
    * Sets the free connection timeout for this pool. If the pool has a max connections setting,
    * operations will block if all of the connections are in use. The free connection timeout
    * specifies how long those operations will block waiting for a free connection before
receiving

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/cache/client/Pool.java
----------------------------------------------------------------------
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 69cec87..e910e01 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
@@ -62,6 +62,13 @@ public interface Pool {
   public String getName();
 
   /**
+   * Returns the socket connect timeout of this pool.
+   *
+   * @see PoolFactory#setSocketConnectTimeout(int)
+   */
+  public int getSocketConnectTimeout();
+
+  /**
    * Returns the connection timeout of this pool.
    * 
    * @see PoolFactory#setFreeConnectionTimeout

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/cache/client/PoolFactory.java
----------------------------------------------------------------------
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 45c37d9..c5bb863 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
@@ -55,6 +55,14 @@ import org.apache.geode.cache.query.*; // for javadocs
  */
 public interface PoolFactory {
   /**
+   * The default amount of time, in milliseconds, socket timeout when the client connects
to the
+   * servers/locators.
+   * <p>
+   * Current value: <code>59000</code>.
+   */
+  public static final int DEFAULT_SOCKET_CONNECT_TIMEOUT = 59000;
+
+  /**
    * The default amount of time, in milliseconds, which we will wait for a free connection
if max
    * connections is set and all of the connections are in use.
    * <p>
@@ -189,6 +197,18 @@ public interface PoolFactory {
   public static final boolean DEFAULT_MULTIUSER_AUTHENTICATION = false;
 
   /**
+   * Sets the socket connect timeout for this pool. The number of milli seconds specified
as socket
+   * timeout when the client connects to the servers/locators. A timeout of zero is interpreted
as
+   * an infinite timeout. The connection will then block until established or an error occurs.
+   *
+   * @param socketConnectTimeout timeout in milliseconds when the client connects to the
servers
+   * @return a reference to <code>this</code>
+   * @throws IllegalArgumentException if <code>socketConnectTimeout</code> is
less than or equal to
+   *         <code>-1</code>.
+   */
+  public PoolFactory setSocketConnectTimeout(int socketConnectTimeout);
+
+  /**
    * Sets the free connection timeout for this pool. If the pool has a max connections setting,
    * operations will block if all of the connections are in use. The free connection timeout
    * specifies how long those operations will block waiting for a free connection before
receiving

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
----------------------------------------------------------------------
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 882c7e6..3ded54a 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
@@ -83,10 +83,6 @@ public class PoolImpl implements InternalPool {
 
   private static final Logger logger = LogService.getLogger();
 
-  private static final int HANDSHAKE_TIMEOUT =
-      Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.HANDSHAKE_TIMEOUT",
-          AcceptorImpl.DEFAULT_HANDSHAKE_TIMEOUT_MS);
-
   public static final long SHUTDOWN_TIMEOUT =
       Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.SHUTDOWN_TIMEOUT", 30000);
 
@@ -103,6 +99,7 @@ public class PoolImpl implements InternalPool {
   public volatile static boolean TEST_DURABLE_IS_NET_DOWN = false;
 
   private final String name;
+  private final int socketConnectTimeout;
   private final int freeConnectionTimeout;
   private final int loadConditioningInterval;
   private final int socketBufferSize;
@@ -184,6 +181,7 @@ public class PoolImpl implements InternalPool {
   protected PoolImpl(PoolManagerImpl pm, String name, Pool attributes) {
     this.pm = pm;
     this.name = name;
+    this.socketConnectTimeout = attributes.getSocketConnectTimeout();
     this.freeConnectionTimeout = attributes.getFreeConnectionTimeout();
     this.loadConditioningInterval = attributes.getLoadConditioningInterval();
     this.socketBufferSize = attributes.getSocketBufferSize();
@@ -246,8 +244,8 @@ public class PoolImpl implements InternalPool {
     source = getSourceImpl(((PoolFactoryImpl.PoolAttributes) attributes).locatorCallback);
     endpointManager = new EndpointManagerImpl(name, ds, this.cancelCriterion, this.stats);
     connectionFactory = new ConnectionFactoryImpl(source, endpointManager, ds, socketBufferSize,
-        HANDSHAKE_TIMEOUT, readTimeout, proxyId, this.cancelCriterion, usedByGateway, gatewaySender,
-        pingInterval, multiuserSecureModeEnabled, this);
+        socketConnectTimeout, readTimeout, proxyId, this.cancelCriterion, usedByGateway,
+        gatewaySender, pingInterval, multiuserSecureModeEnabled, this);
     if (subscriptionEnabled) {
       queueManager = new QueueManagerImpl(this, endpointManager, source, connectionFactory,
           subscriptionRedundancyLevel, pingInterval, securityLogWriter, proxyId);
@@ -277,6 +275,7 @@ public class PoolImpl implements InternalPool {
     if (p == null)
       return false;
     return getFreeConnectionTimeout() == p.getFreeConnectionTimeout()
+        && getSocketConnectTimeout() == p.getSocketConnectTimeout()
         && getLoadConditioningInterval() == p.getLoadConditioningInterval()
         && getSocketBufferSize() == p.getSocketBufferSize()
         && getMinConnections() == p.getMinConnections()
@@ -387,6 +386,10 @@ public class PoolImpl implements InternalPool {
     return this.name;
   }
 
+  public int getSocketConnectTimeout() {
+    return this.socketConnectTimeout;
+  }
+
   public int getFreeConnectionTimeout() {
     return this.freeConnectionTimeout;
   }
@@ -641,7 +644,7 @@ public class PoolImpl implements InternalPool {
       return new ExplicitConnectionSourceImpl(getServers());
     } else {
       AutoConnectionSourceImpl source =
-          new AutoConnectionSourceImpl(locators, getServerGroup(), HANDSHAKE_TIMEOUT);
+          new AutoConnectionSourceImpl(locators, getServerGroup(), socketConnectTimeout);
       if (locatorDiscoveryCallback != null) {
         source.setLocatorDiscoveryCallback(locatorDiscoveryCallback);
       }
@@ -663,6 +666,10 @@ public class PoolImpl implements InternalPool {
       throw new RuntimeException(
           LocalizedStrings.PoolImpl_0_ARE_DIFFERENT.toLocalizedString("names"));
     }
+    if (getSocketConnectTimeout() != other.getSocketConnectTimeout()) {
+      throw new RuntimeException(
+          LocalizedStrings.PoolImpl_0_IS_DIFFERENT.toLocalizedString("socketConnectimeout"));
+    }
     if (getFreeConnectionTimeout() != other.getFreeConnectionTimeout()) {
       throw new RuntimeException(
           LocalizedStrings.PoolImpl_0_IS_DIFFERENT.toLocalizedString("connectionTimeout"));

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/internal/cache/PoolFactoryImpl.java
----------------------------------------------------------------------
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 093b6cf..d4fdbd0 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
@@ -64,6 +64,14 @@ public class PoolFactoryImpl implements PoolFactory {
     this.pm = pm;
   }
 
+  public PoolFactory setSocketConnectTimeout(int socketConnectTimeout) {
+    if (socketConnectTimeout <= -1) {
+      throw new IllegalArgumentException("socketConnectTimeout must be greater than -1");
+    }
+    this.attributes.socketConnectTimeout = socketConnectTimeout;
+    return this;
+  }
+
   public PoolFactory setFreeConnectionTimeout(int connectionTimeout) {
     if (connectionTimeout <= 0) {
       throw new IllegalArgumentException("connectionTimeout must be greater than zero");
@@ -268,6 +276,7 @@ public class PoolFactoryImpl implements PoolFactory {
    * Initializes the state of this factory for the given pool's state.
    */
   public void init(Pool cp) {
+    setSocketConnectTimeout(cp.getSocketConnectTimeout());
     setFreeConnectionTimeout(cp.getFreeConnectionTimeout());
     setLoadConditioningInterval(cp.getLoadConditioningInterval());
     setSocketBufferSize(cp.getSocketBufferSize());
@@ -335,6 +344,7 @@ 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;
     public int socketBufferSize = DEFAULT_SOCKET_BUFFER_SIZE;
@@ -363,6 +373,10 @@ public class PoolFactoryImpl implements PoolFactory {
      */
     public boolean gateway = false;
 
+    public int getSocketConnectTimeout() {
+      return this.socketConnectTimeout;
+    }
+
     public int getFreeConnectionTimeout() {
       return this.connectionTimeout;
     }
@@ -529,6 +543,7 @@ public class PoolFactoryImpl implements PoolFactory {
       DataSerializer.writeArrayList(this.servers, out);
       DataSerializer.writePrimitiveInt(this.statisticInterval, out);
       DataSerializer.writePrimitiveBoolean(this.multiuserSecureModeEnabled, out);
+      DataSerializer.writePrimitiveInt(this.socketConnectTimeout, out);
     }
 
     public void fromData(DataInput in) throws IOException, ClassNotFoundException {
@@ -550,6 +565,7 @@ public class PoolFactoryImpl implements PoolFactory {
       this.servers = DataSerializer.readArrayList(in);
       this.statisticInterval = DataSerializer.readPrimitiveInt(in);
       this.multiuserSecureModeEnabled = DataSerializer.readPrimitiveBoolean(in);
+      this.socketConnectTimeout = DataSerializer.readPrimitiveInt(in);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXml.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXml.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXml.java
index bcf78a9..2dd6533 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXml.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXml.java
@@ -605,6 +605,7 @@ public abstract class CacheXml implements EntityResolver2, ErrorHandler
{
   public static final String POOL_NAME = "pool-name";
   public static final String SERVER = "server";
   public static final String LOCATOR = "locator";
+  public static final String SOCKET_CONNECT_TIMEOUT = "socket-connect-timeout";
   public static final String FREE_CONNECTION_TIMEOUT = "free-connection-timeout";
   public static final String LOAD_CONDITIONING_INTERVAL = "load-conditioning-interval";
   public static final String MIN_CONNECTIONS = "min-connections";

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java
index 0cee768..98427ea 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlGenerator.java
@@ -1185,6 +1185,12 @@ public class CacheXmlGenerator extends CacheXml implements XMLReader
{
     AttributesImpl atts = new AttributesImpl();
     try {
       atts.addAttribute("", "", NAME, "", cp.getName());
+      if (this.version.compareTo(CacheXmlVersion.GEODE_1_0) > 0) {
+        if (generateDefaults()
+            || cp.getSocketConnectTimeout() != PoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT)
+          atts.addAttribute("", "", SOCKET_CONNECT_TIMEOUT, "",
+              String.valueOf(cp.getSocketConnectTimeout()));
+      }
       if (generateDefaults()
           || cp.getFreeConnectionTimeout() != PoolFactory.DEFAULT_FREE_CONNECTION_TIMEOUT)
         atts.addAttribute("", "", FREE_CONNECTION_TIMEOUT, "",

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java
index 04ab020..b1d2929 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParser.java
@@ -400,6 +400,10 @@ public class CacheXmlParser extends CacheXml implements ContentHandler
{
     stack.push(name);
     stack.push(f);
     String v;
+    v = atts.getValue(SOCKET_CONNECT_TIMEOUT);
+    if (v != null) {
+      f.setSocketConnectTimeout(parseInt(v));
+    }
     v = atts.getValue(FREE_CONNECTION_TIMEOUT);
     if (v != null) {
       f.setFreeConnectionTimeout(parseInt(v));

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
----------------------------------------------------------------------
diff --git a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
index d3d83f1..1bcd83a 100755
--- a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
+++ b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd
@@ -60,7 +60,7 @@ declarative caching XML file elements unless indicated otherwise.
 
 - In elements whose value is an "enumerated type", the value is case
   sensitive.
-  
+
   ]]></xsd:documentation>
   </xsd:annotation>
 
@@ -1191,6 +1191,7 @@ As of 6.5 disk-dirs is deprecated on region-attributes. Use disk-store-name
inst
         </xsd:complexType>
       </xsd:element>
     </xsd:choice>
+    <xsd:attribute name="socket-connect-timeout" type="xsd:string" use="optional" />
     <xsd:attribute name="free-connection-timeout" type="xsd:string" use="optional" />
     <xsd:attribute name="load-conditioning-interval" type="xsd:string" use="optional"
/>
     <xsd:attribute name="min-connections" type="xsd:string" use="optional" />

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/java/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest.java
index c633a47..f714742 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest.java
@@ -103,6 +103,7 @@ public class ClientCacheFactoryJUnitTest {
         Collections.singletonList(
             new InetSocketAddress(InetAddress.getLocalHost(), CacheServer.DEFAULT_PORT)),
         defPool.getServers());
+    assertEquals(PoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT, defPool.getSocketConnectTimeout());
 
     ClientCache cc2 = new ClientCacheFactory().create();
     if (cc2 != this.cc) {
@@ -141,6 +142,7 @@ public class ClientCacheFactoryJUnitTest {
     assertEquals(
         Collections.singletonList(new InetSocketAddress("localhost", CacheServer.DEFAULT_PORT)),
         defPool.getServers());
+    assertEquals(PoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT, defPool.getSocketConnectTimeout());
   }
 
   /**
@@ -152,12 +154,13 @@ public class ClientCacheFactoryJUnitTest {
     dsProps.setProperty(MCAST_PORT, "0");
     DistributedSystem ds = DistributedSystem.connect(dsProps);
     Pool p = PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(),
7777)
-        .create("singlePool");
+        .setSocketConnectTimeout(1400).create("singlePool");
     this.cc = new ClientCacheFactory().create();
     GemFireCacheImpl gfc = (GemFireCacheImpl) this.cc;
     assertEquals(true, gfc.isClient());
     Pool defPool = gfc.getDefaultPool();
     assertEquals(p, defPool);
+    assertEquals(1400, defPool.getSocketConnectTimeout());
 
     // make sure if we can not create a secure user cache when one pool
     // exists that is not multiuser enabled
@@ -175,7 +178,7 @@ public class ClientCacheFactoryJUnitTest {
 
       Pool pool = PoolManager.createFactory()
           .addServer(InetAddress.getLocalHost().getHostName(), CacheServer.DEFAULT_PORT)
-          .setMultiuserAuthentication(true).create("pool1");
+          .setMultiuserAuthentication(true).setSocketConnectTimeout(2345).create("pool1");
       RegionService cc = this.cc.createAuthenticatedView(suProps, pool.getName());
       ProxyCache pc = (ProxyCache) cc;
       UserAttributes ua = pc.getUserAttributes();
@@ -185,6 +188,7 @@ public class ClientCacheFactoryJUnitTest {
               new InetSocketAddress(InetAddress.getLocalHost(), CacheServer.DEFAULT_PORT)),
           proxyDefPool.getServers());
       assertEquals(true, proxyDefPool.getMultiuserAuthentication());
+      assertEquals(2345, proxyDefPool.getSocketConnectTimeout());
     }
   }
 
@@ -197,14 +201,16 @@ public class ClientCacheFactoryJUnitTest {
     dsProps.setProperty(MCAST_PORT, "0");
     DistributedSystem ds = DistributedSystem.connect(dsProps);
     PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(), 7777)
-        .create("p7");
+        .setSocketConnectTimeout(2500).create("p7");
     PoolManager.createFactory().addServer(InetAddress.getLocalHost().getHostName(), 6666)
-        .create("p6");
+        .setSocketConnectTimeout(5200).create("p6");
     this.cc = new ClientCacheFactory().create();
     GemFireCacheImpl gfc = (GemFireCacheImpl) this.cc;
     assertEquals(true, gfc.isClient());
     Pool defPool = gfc.getDefaultPool();
     assertEquals(null, defPool);
+    assertEquals(2500, PoolManager.find("p7").getSocketConnectTimeout());
+    assertEquals(5200, PoolManager.find("p6").getSocketConnectTimeout());
 
     // make sure if we can not create a secure user cache when more than one pool
     // exists that is not multiuser enabled
@@ -231,18 +237,28 @@ public class ClientCacheFactoryJUnitTest {
               new InetSocketAddress(InetAddress.getLocalHost(), CacheServer.DEFAULT_PORT)),
           proxyDefPool.getServers());
       assertEquals(true, proxyDefPool.getMultiuserAuthentication());
+      assertEquals(PoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT,
+          proxyDefPool.getSocketConnectTimeout());
     }
   }
 
   @Test
   public void test004SetMethod() throws Exception {
-    this.cc = new ClientCacheFactory().set(LOG_LEVEL, "severe").create();
+    this.cc =
+        new ClientCacheFactory().set(LOG_LEVEL, "severe").setPoolSocketConnectTimeout(0).create();
     GemFireCacheImpl gfc = (GemFireCacheImpl) this.cc;
     assertEquals(true, gfc.isClient());
     Properties dsProps = this.cc.getDistributedSystem().getProperties();
     assertEquals("0", dsProps.getProperty(MCAST_PORT));
     assertEquals("", dsProps.getProperty(LOCATORS));
     assertEquals("severe", dsProps.getProperty(LOG_LEVEL));
+    assertEquals(0, this.cc.getDefaultPool().getSocketConnectTimeout());
+
+    try {
+      new ClientCacheFactory().setPoolSocketConnectTimeout(-1).create();
+      fail("expected IllegalArgumentException");
+    } catch (IllegalArgumentException ignore) {
+    }
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
index da3cbdb..3cc3cfc 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplJUnitTest.java
@@ -351,6 +351,10 @@ public class AutoConnectionSourceImplJUnitTest {
       return false;
     }
 
+    public int getSocketConnectTimeout() {
+      return 0;
+    }
+
     public int getFreeConnectionTimeout() {
       return 0;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java
index d99b31a..95b5a92 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionPoolImplJUnitTest.java
@@ -101,6 +101,7 @@ public class ConnectionPoolImplJUnitTest {
     PoolImpl pool = (PoolImpl) cpf.create("myfriendlypool");
 
     // check defaults
+    assertEquals(PoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT, pool.getSocketConnectTimeout());
     assertEquals(PoolFactory.DEFAULT_FREE_CONNECTION_TIMEOUT, pool.getFreeConnectionTimeout());
     assertEquals(PoolFactory.DEFAULT_SOCKET_BUFFER_SIZE, pool.getSocketBufferSize());
     assertEquals(PoolFactory.DEFAULT_READ_TIMEOUT, pool.getReadTimeout());
@@ -131,14 +132,17 @@ public class ConnectionPoolImplJUnitTest {
   @Test
   public void testProperties() throws Exception {
     int readTimeout = 234234;
+    int socketTimeout = 123123;
 
     PoolFactory cpf = PoolManager.createFactory();
-    cpf.addServer("localhost", port).setReadTimeout(readTimeout).setThreadLocalConnections(true);
+    cpf.addServer("localhost", port).setSocketConnectTimeout(socketTimeout)
+        .setReadTimeout(readTimeout).setThreadLocalConnections(true);
 
     PoolImpl pool = (PoolImpl) cpf.create("myfriendlypool");
 
     // check non default
     assertEquals("myfriendlypool", pool.getName());
+    assertEquals(socketTimeout, pool.getSocketConnectTimeout());
     assertEquals(readTimeout, pool.getReadTimeout());
     assertEquals(true, pool.getThreadLocalConnections());
     assertEquals(1, pool.getServers().size());

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
index 6afb501..992a6f0 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
@@ -361,6 +361,10 @@ public class QueueManagerJUnitTest {
 
     public void destroy(boolean keepAlive) {}
 
+    public int getSocketConnectTimeout() {
+      return 0;
+    }
+
     public int getFreeConnectionTimeout() {
       return 0;
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/resources/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest_single_pool.xml
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest_single_pool.xml
b/geode-core/src/test/resources/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest_single_pool.xml
index 2a7e8f4..f139459 100644
--- a/geode-core/src/test/resources/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest_single_pool.xml
+++ b/geode-core/src/test/resources/org/apache/geode/cache/client/ClientCacheFactoryJUnitTest_single_pool.xml
@@ -20,11 +20,12 @@
      Configures a region as a client region in a Security cache. The 
      region's pool connects to a server listening on port 40404.
 -->
-<!DOCTYPE client-cache PUBLIC
-  "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
-  "http://www.gemstone.com/dtd/cache7_0.dtd">
-<client-cache>
+<client-cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns="http://geode.apache.org/schema/cache"
+  xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
+  xsi:noNamespaceSchemaLocation="cache-test.xsd"
+  version="1.0">
   <pool name="my_pool_name" multiuser-authentication="true">
     <server host="localhost" port="40404"/>
   </pool>
-</client-cache>
\ No newline at end of file
+</client-cache>

http://git-wip-us.apache.org/repos/asf/geode/blob/61b1d0c4/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index f54ff74..b69e004 100644
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -1167,8 +1167,8 @@ fromData,207,2a2bb900500100b500162a2bb900510100b80052b500032a2bb80053b500182a2bb
 toData,178,2b2ab40016b9004702002b2ab40003b40048b9004902002ab400182bb8004a2b2ab40005b9004b02002b2ab4001fb9004b02002ab400042bb8004a2ab400082bb8004c2ab400092bb8004c2ab400072bb8004c2ab4000c2bb8004a2ab4000e2bb8004a2ab4000d2bb8004a2ab400102bb8004a2ab4000f2bb8004a2b2ab40006b9004b02002ab400112bb8004d2ab400142bb8004e2ab40001b9004f010099000b012bb8004da7000b2ab400012bb8004db1
 
 org/apache/geode/internal/cache/PoolFactoryImpl$PoolAttributes,2
-fromData,145,2a2bb80032b500032a2bb80032b500052a2bb80032b500072a2bb80032b500092a2bb80032b5000a2a2bb80032b5000b2a2bb80032b5000f2a2bb80033b5000e2a2bb80033b500122a2bb80032b500162a2bb80032b500182a2bb80034b500082a2bb80034b500142a2bb80035b5001b2a2bb80036b5001f2a2bb80036b500202a2bb80032b500132a2bb80034b5001cb1
-toData,145,2ab400032bb8002d2ab400052bb8002d2ab400072bb8002d2ab400092bb8002d2ab4000a2bb8002d2ab4000b2bb8002d2ab4000f2bb8002d2ab4000e2bb8002e2ab400122bb8002e2ab400162bb8002d2ab400182bb8002d2ab400082bb8002f2ab400142bb8002f2ab4001b2bb800302ab4001f2bb800312ab400202bb800312ab400132bb8002d2ab4001c2bb8002fb1
+fromData,153,2a2bb80034b500052a2bb80034b500072a2bb80034b500092a2bb80034b5000b2a2bb80034b5000c2a2bb80034b5000d2a2bb80034b500112a2bb80035b500102a2bb80035b500142a2bb80034b500182a2bb80034b5001a2a2bb80036b5000a2a2bb80036b500162a2bb80037b5001d2a2bb80038b500212a2bb80038b500222a2bb80034b500152a2bb80036b5001e2a2bb80034b50004b1
+toData,153,2ab400052bb8002f2ab400072bb8002f2ab400092bb8002f2ab4000b2bb8002f2ab4000c2bb8002f2ab4000d2bb8002f2ab400112bb8002f2ab400102bb800302ab400142bb800302ab400182bb8002f2ab4001a2bb8002f2ab4000a2bb800312ab400162bb800312ab4001d2bb800322ab400212bb800332ab400222bb800332ab400152bb8002f2ab4001e2bb800312ab400042bb8002fb1
 
 org/apache/geode/internal/cache/PreferBytesCachedDeserializable,2
 fromData,9,2a2bb8000fb50003b1


Mime
View raw message