geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [50/90] [abbrv] incubator-geode git commit: GEODE-1377: Initial move of system properties from private to public
Date Wed, 08 Jun 2016 00:05:27 GMT
GEODE-1377: Initial move of system properties from private to public


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

Branch: refs/heads/feature/GEODE-835
Commit: 690ca40b9c6dfa41affb31d12c66449c963682f1
Parents: f84b1c0
Author: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Authored: Wed Jun 1 17:34:07 2016 +1000
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Thu Jun 2 10:01:42 2016 +1000

----------------------------------------------------------------------
 .../cache/client/ClientCacheFactory.java        | 465 ++++++++++---------
 .../gemfire/cache/client/internal/PoolImpl.java |   2 +-
 .../SystemConfigurationProperties.java          |   3 -
 .../internal/DistributionConfig.java            |   4 +-
 .../CacheServerSSLConnectionDUnitTest.java      |  31 +-
 5 files changed, 252 insertions(+), 253 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/690ca40b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/ClientCacheFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/ClientCacheFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/ClientCacheFactory.java
index 3cbfff8..738361d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/ClientCacheFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/ClientCacheFactory.java
@@ -34,109 +34,112 @@ import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.LOC
 import static com.gemstone.gemfire.distributed.SystemConfigurationProperties.MCAST_PORT;
 
 /**
-Factory class used to create the singleton {@link ClientCache client cache} and connect to one or more GemFire Cache Servers. If the application wants to connect to GemFire as a peer it should use {@link com.gemstone.gemfire.cache.CacheFactory} instead.
-<p> Once the factory has been configured using its set* methods you produce a {@link ClientCache} by calling the {@link #create} method.
-The
-<a href="../distribution/DistributedSystem.html#cache-xml-file">"cache-xml-file"</a>
-property can be used to specify a cache.xml file to initialize the cache with.
-The contents of this file must comply with the
- <code>"doc-files/cache8_0.dtd"</code> file and the top level element must be a <code>client-cache</code> element.
-<p> Client connections are managed through connection {@link Pool pools}. ClientCacheFactory creates a single pool to use by default on the cache it creates. ClientCacheFactory can also be used to configure the default connection pool using its <code>setPool*</code> and <code>addPool*</code> methods. In most cases, the defaults used by this implementation will suffice. For the default pool attributes see {@link PoolFactory}.
-If no pool is configured and a pool was not declared in cache.xml or created using {@link PoolManager} then a default one will be created that connects to a server on the default cache server port and local host. If multiple pools are declared in cache.xml or created by the PoolFactory then no default pool will exist and <code>ClientRegionFactory.setPoolName</code> will need to be called on each region created.
-<p>
-To get the existing unclosed singleton client cache instance call {@link #getAnyInstance}.
-<p>
-The following examples illustrate bootstrapping the client cache using region shortcuts:
-<p>
-Example 1: Connect to a CacheServer on the default host and port and access a region "customers"
-<PRE>
-  ClientCache c = new ClientCacheFactory().create();
-  Region r = c.createClientRegionFactory(PROXY).create("customers");
-  // The PROXY shortcut tells GemFire to route all requests to the servers
-  //. i.e. there is no local caching
-</PRE>
-Example 2: Connect using the GemFire locator and create a local LRU cache
-<PRE>
-  ClientCache c = new ClientCacheFactory()
-      .addPoolLocator(host, port)
-      .create();
-  Region r = c.createClientRegionFactory(CACHING_PROXY_HEAP_LRU)
-      .create("customers");
-  // The local LRU "customers" data region will automatically start evicting, by default, at 80% heap utilization threshold
-</PRE>
-Example 3: Access the query service
-<PRE>
-  QueryService qs = new ClientCacheFactory().create().getQueryService();
-</PRE>
-Example 4: Construct the client cache region declaratively in cache.xml
-<PRE>
-  &lt;!DOCTYPE client-cache PUBLIC
-    "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"
-    "http://www.gemstone.com/dtd/cache8_0.dtd">
-  &lt;client-cache>	
-    &lt;pool name="myPool">
-      &lt;locator host="hostName" port="10334"/>
-    &lt;/pool>
-    &lt;region name="myRegion" refid="PROXY"/>
-      &lt;!-- you can override or add to the PROXY attributes by adding
-           a region-attributes sub element here -->
-  &lt;/client-cache>
-</PRE>
-Now, create the cache telling it to read your cache.xml file:
-<PRE>
-  ClientCache c = new ClientCacheFactory()
-    .set("cache-xml-file", "myCache.xml")
-    .create();
-  Region r = c.getRegion("myRegion");
-</PRE>
-
-<p> For a complete list of all client region shortcuts see {@link ClientRegionShortcut}. 
-Applications that need to explicitly control the individual region attributes can do this declaratively in XML or using API.
-<p>
-Example 5: Define custom region attributes for persistence in XML and create region using API.
-  Define new region attributes with ID "MYAPP_CACHING_PROXY_MEM_LRU" that overrides the 
-  "CACHING_PROXY" shortcut
-<PRE>
- &lt;!DOCTYPE client-cache PUBLIC
-    "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
-    "http://www.gemstone.com/dtd/cache8_0.dtd">
- &lt;client-cache>
-  &lt;!-- now create a named region attributes that uses the CACHING_PROXY shortcut
-       and adds a memory LRU limited to 900 megabytes --> 
-  &lt;region-attributes id="MYAPP_CACHING_PROXY_MEM_LRU" refid="CACHING_PROXY" >
-    &lt;lru-memory-size maximum="900"/>
-  &lt;/region-attributes>
- &lt;/client-cache> 
-</PRE>
-Now, create the data region in the client cache using this new attributes ID.
-<PRE>
-  ClientCache c = new ClientCacheFactory()
-    .set("cache-xml-file", "myCache.xml")
-    .addPoolLocator(host, port)
-    .create();
-  Region r = c.createClientRegionFactory("MYAPP_CACHING_PROXY_MEM_LRU").create("customers");
-</PRE>
- * @since GemFire 6.5
+ * Factory class used to create the singleton {@link ClientCache client cache} and connect to one or more GemFire Cache Servers. If the application wants to connect to GemFire as a peer it should use {@link com.gemstone.gemfire.cache.CacheFactory} instead.
+ * <p> Once the factory has been configured using its set* methods you produce a {@link ClientCache} by calling the {@link #create} method.
+ * The
+ * <a href="../distribution/DistributedSystem.html#cache-xml-file">"cache-xml-file"</a>
+ * property can be used to specify a cache.xml file to initialize the cache with.
+ * The contents of this file must comply with the
+ * <code>"doc-files/cache8_0.dtd"</code> file and the top level element must be a <code>client-cache</code> element.
+ * <p> Client connections are managed through connection {@link Pool pools}. ClientCacheFactory creates a single pool to use by default on the cache it creates. ClientCacheFactory can also be used to configure the default connection pool using its <code>setPool*</code> and <code>addPool*</code> methods. In most cases, the defaults used by this implementation will suffice. For the default pool attributes see {@link PoolFactory}.
+ * If no pool is configured and a pool was not declared in cache.xml or created using {@link PoolManager} then a default one will be created that connects to a server on the default cache server port and local host. If multiple pools are declared in cache.xml or created by the PoolFactory then no default pool will exist and <code>ClientRegionFactory.setPoolName</code> will need to be called on each region created.
+ * <p>
+ * To get the existing unclosed singleton client cache instance call {@link #getAnyInstance}.
+ * <p>
+ * The following examples illustrate bootstrapping the client cache using region shortcuts:
+ * <p>
+ * Example 1: Connect to a CacheServer on the default host and port and access a region "customers"
+ * <PRE>
+ * ClientCache c = new ClientCacheFactory().create();
+ * Region r = c.createClientRegionFactory(PROXY).create("customers");
+ * // The PROXY shortcut tells GemFire to route all requests to the servers
+ * //. i.e. there is no local caching
+ * </PRE>
+ * Example 2: Connect using the GemFire locator and create a local LRU cache
+ * <PRE>
+ * ClientCache c = new ClientCacheFactory()
+ * .addPoolLocator(host, port)
+ * .create();
+ * Region r = c.createClientRegionFactory(CACHING_PROXY_HEAP_LRU)
+ * .create("customers");
+ * // The local LRU "customers" data region will automatically start evicting, by default, at 80% heap utilization threshold
+ * </PRE>
+ * Example 3: Access the query service
+ * <PRE>
+ * QueryService qs = new ClientCacheFactory().create().getQueryService();
+ * </PRE>
+ * Example 4: Construct the client cache region declaratively in cache.xml
+ * <PRE>
+ * &lt;!DOCTYPE client-cache PUBLIC
+ * "-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"
+ * "http://www.gemstone.com/dtd/cache8_0.dtd">
+ * &lt;client-cache>
+ * &lt;pool name="myPool">
+ * &lt;locator host="hostName" port="10334"/>
+ * &lt;/pool>
+ * &lt;region name="myRegion" refid="PROXY"/>
+ * &lt;!-- you can override or add to the PROXY attributes by adding
+ * a region-attributes sub element here -->
+ * &lt;/client-cache>
+ * </PRE>
+ * Now, create the cache telling it to read your cache.xml file:
+ * <PRE>
+ * ClientCache c = new ClientCacheFactory()
+ * .set("cache-xml-file", "myCache.xml")
+ * .create();
+ * Region r = c.getRegion("myRegion");
+ * </PRE>
+ * <p>
+ * <p> For a complete list of all client region shortcuts see {@link ClientRegionShortcut}.
+ * Applications that need to explicitly control the individual region attributes can do this declaratively in XML or using API.
+ * <p>
+ * Example 5: Define custom region attributes for persistence in XML and create region using API.
+ * Define new region attributes with ID "MYAPP_CACHING_PROXY_MEM_LRU" that overrides the
+ * "CACHING_PROXY" shortcut
+ * <PRE>
+ * &lt;!DOCTYPE client-cache PUBLIC
+ * "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
+ * "http://www.gemstone.com/dtd/cache8_0.dtd">
+ * &lt;client-cache>
+ * &lt;!-- now create a named region attributes that uses the CACHING_PROXY shortcut
+ * and adds a memory LRU limited to 900 megabytes -->
+ * &lt;region-attributes id="MYAPP_CACHING_PROXY_MEM_LRU" refid="CACHING_PROXY" >
+ * &lt;lru-memory-size maximum="900"/>
+ * &lt;/region-attributes>
+ * &lt;/client-cache>
+ * </PRE>
+ * Now, create the data region in the client cache using this new attributes ID.
+ * <PRE>
+ * ClientCache c = new ClientCacheFactory()
+ * .set("cache-xml-file", "myCache.xml")
+ * .addPoolLocator(host, port)
+ * .create();
+ * Region r = c.createClientRegionFactory("MYAPP_CACHING_PROXY_MEM_LRU").create("customers");
+ * </PRE>
+ *
+ * @since 6.5
  */
 public class ClientCacheFactory {
 
   private PoolFactory pf;
-  
+
   private final Properties dsProps;
 
   private final CacheConfig cacheConfig = new CacheConfig();
-  
+
   /**
    * Creates a new client cache factory.
    */
   public ClientCacheFactory() {
     this.dsProps = new Properties();
   }
+
   /**
    * Create a new client cache factory given the initial gemfire properties.
+   *
    * @param props The initial gemfire properties to be used.
-   * These properties can be overridden using the {@link #set} method
-   * For a full list of valid gemfire properties see {@link com.gemstone.gemfire.distributed.DistributedSystem}.
+   *              These properties can be overridden using the {@link #set} method
+   *              For a full list of valid gemfire properties see {@link com.gemstone.gemfire.distributed.DistributedSystem}.
    */
   public ClientCacheFactory(Properties props) {
     if (props == null) {
@@ -148,7 +151,8 @@ public class ClientCacheFactory {
   /**
    * Sets a gemfire property that will be used when creating the ClientCache.
    * For a full list of valid gemfire properties see {@link com.gemstone.gemfire.distributed.DistributedSystem}.
-   * @param name the name of the gemfire property
+   *
+   * @param name  the name of the gemfire property
    * @param value the value of the gemfire property
    * @return a reference to this ClientCacheFactory object
    */
@@ -161,31 +165,26 @@ public class ClientCacheFactory {
    * Create a singleton client cache. If a client cache already exists in this
    * vm that is not compatible with this factory's configuration then create
    * will fail.
-   * <p> While creating the cache instance any declarative cache configuration (cache.xml) 
+   * <p> While creating the cache instance any declarative cache configuration (cache.xml)
    * is processed and used to initialize the created cache.
    * <P>Note that the cache that is produced is a singleton. Before a different instance
    * can be produced the old one must be {@link ClientCache#close closed}.
-   * 
+   *
    * @return the singleton client cache
-   * 
-   * @throws CacheXmlException
-   *         If a problem occurs while parsing the declarative caching
-   *         XML file.
-   * @throws TimeoutException
-   *         If a {@link Region#put(Object, Object)} times out while initializing the
-   *         cache.
-   * @throws CacheWriterException
-   *         If a <code>CacheWriterException</code> is thrown while
-   *         initializing the cache.
-   * @throws RegionExistsException
-   *         If the declarative caching XML file describes a region
-   *         that already exists (including the root region).
-   * @throws IllegalStateException if a client cache already exists and it
-   *         is not compatible with this factory's configuration.
-   * @throws IllegalStateException if mcast-port or locator is set on client cache.
-   * @throws AuthenticationFailedException if authentication fails.
+   * @throws CacheXmlException               If a problem occurs while parsing the declarative caching
+   *                                         XML file.
+   * @throws TimeoutException                If a {@link Region#put(Object, Object)} times out while initializing the
+   *                                         cache.
+   * @throws CacheWriterException            If a <code>CacheWriterException</code> is thrown while
+   *                                         initializing the cache.
+   * @throws RegionExistsException           If the declarative caching XML file describes a region
+   *                                         that already exists (including the root region).
+   * @throws IllegalStateException           if a client cache already exists and it
+   *                                         is not compatible with this factory's configuration.
+   * @throws IllegalStateException           if mcast-port or locator is set on client cache.
+   * @throws AuthenticationFailedException   if authentication fails.
    * @throws AuthenticationRequiredException if server is in secure mode and client cache
-   *         is not configured with security credentials.
+   *                                         is not configured with security credentials.
    */
   public ClientCache create() {
     return basicCreate();
@@ -193,49 +192,50 @@ public class ClientCacheFactory {
 
   private ClientCache basicCreate() {
     synchronized (ClientCacheFactory.class) {
-    GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
-
-    {
-      String propValue = this.dsProps.getProperty(MCAST_PORT);
-      if (propValue != null) {
-        int mcastPort = Integer.parseInt(propValue);
-        if (mcastPort != 0) {
-          throw new IllegalStateException("On a client cache the mcast-port must be set to 0 or not set. It was set to " + mcastPort);
+      GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
+
+      {
+        String propValue = this.dsProps.getProperty(MCAST_PORT);
+        if (propValue != null) {
+          int mcastPort = Integer.parseInt(propValue);
+          if (mcastPort != 0) {
+            throw new IllegalStateException("On a client cache the mcast-port must be set to 0 or not set. It was set to " + mcastPort);
+          }
         }
       }
-    }
-    {
-      String propValue = this.dsProps.getProperty(LOCATORS);
-      if (propValue != null && !propValue.equals("")) {
-        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 + "\".");
+      {
+        String propValue = this.dsProps.getProperty(LOCATORS);
+        if (propValue != null && !propValue.equals("")) {
+          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, "");
-    DistributedSystem system = DistributedSystem.connect(this.dsProps);
+      DistributedSystem system = DistributedSystem.connect(this.dsProps);
 
-    if (instance != null && !instance.isClosed()) {
-      // this is ok; just make sure it is a client cache
-      if (!instance.isClient()) {
-        throw new IllegalStateException("A client cache can not be created because a non-client cache already exists.");
-      }
+      if (instance != null && !instance.isClosed()) {
+        // this is ok; just make sure it is a client cache
+        if (!instance.isClient()) {
+          throw new IllegalStateException("A client cache can not be created because a non-client cache already exists.");
+        }
 
-      // check if pool is compatible
-      Pool pool = instance.determineDefaultPool(this.pf);
-      if (pool == null) {
-        if (instance.getDefaultPool() != null) {
-          throw new IllegalStateException("Existing cache's default pool was not compatible");
+        // check if pool is compatible
+        Pool pool = instance.determineDefaultPool(this.pf);
+        if (pool == null) {
+          if (instance.getDefaultPool() != null) {
+            throw new IllegalStateException("Existing cache's default pool was not compatible");
+          }
         }
+
+        // Check if cache configuration matches.
+        cacheConfig.validateCacheConfig(instance);
+
+        return instance;
+      } else {
+        GemFireCacheImpl gfc = GemFireCacheImpl.createClient(system, this.pf, cacheConfig);
+        return gfc;
       }
-      
-      // Check if cache configuration matches.
-      cacheConfig.validateCacheConfig(instance);
-      
-      return instance;
-    } else {
-      GemFireCacheImpl gfc = GemFireCacheImpl.createClient(system, this.pf, cacheConfig);
-      return gfc;
-    }
     }
   }
 
@@ -245,35 +245,38 @@ public class ClientCacheFactory {
     }
     return this.pf;
   }
-  
+
   /**
    * 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
-   * an {@link AllConnectionsInUseException}. If max connections 
+   * an {@link AllConnectionsInUseException}. If max connections
    * is not set this setting has no effect.
-   * @see #setPoolMaxConnections(int)
+   *
    * @param connectionTimeout the connection timeout in milliseconds
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>connectionTimeout</code>
-   * is less than or equal to <code>0</code>.
+   *                                  is less than or equal to <code>0</code>.
+   * @see #setPoolMaxConnections(int)
    */
   public ClientCacheFactory setPoolFreeConnectionTimeout(int connectionTimeout) {
     getPoolFactory().setFreeConnectionTimeout(connectionTimeout);
     return this;
   }
+
   /**
    * Sets the load conditioning interval for this pool.
-   * This interval controls how frequently the pool will check to see if 
+   * This interval controls how frequently the pool will check to see if
    * a connection to a given server should be moved to a different
-   * server to improve the load balance.  
+   * server to improve the load balance.
    * <p>A value of <code>-1</code> disables load conditioning
+   *
    * @param loadConditioningInterval the connection lifetime in milliseconds
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>connectionLifetime</code>
-   * is less than <code>-1</code>.
+   *                                  is less than <code>-1</code>.
    */
   public ClientCacheFactory setPoolLoadConditioningInterval(int loadConditioningInterval) {
     getPoolFactory().setLoadConditioningInterval(loadConditioningInterval);
@@ -285,11 +288,12 @@ public class ClientCacheFactory {
    * Large messages can be received and sent faster when this buffer is larger.
    * Larger buffers also optimize the rate at which servers can send events
    * for client subscriptions.
+   *
    * @param bufferSize the size of the socket buffers used for reading and
-   * writing on each connection in this pool.
+   *                   writing on each connection in this pool.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>bufferSize</code>
-   * is less than or equal to <code>0</code>.
+   *                                  is less than or equal to <code>0</code>.
    */
   public ClientCacheFactory setPoolSocketBufferSize(int bufferSize) {
     getPoolFactory().setSocketBufferSize(bufferSize);
@@ -307,8 +311,9 @@ public class ClientCacheFactory {
    * as the operation being done with the connection completes. This allows
    * connections to be shared amonst multiple threads keeping the number of
    * connections down.
+   *
    * @param threadLocalConnections if <code>true</code> then enable thread local
-   * connections.
+   *                               connections.
    * @return a reference to <code>this</code>
    */
   public ClientCacheFactory setPoolThreadLocalConnections(boolean threadLocalConnections) {
@@ -316,100 +321,100 @@ public class ClientCacheFactory {
     return this;
   }
 
-  
   /**
    * Sets the number of milliseconds to wait for a response from a server before
    * timing out the operation and trying another server (if any are available).
+   *
    * @param timeout number of milliseconds to wait for a response from a server
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>timeout</code>
-   * is less than <code>0</code>.
+   *                                  is less than <code>0</code>.
    */
   public ClientCacheFactory setPoolReadTimeout(int timeout) {
     getPoolFactory().setReadTimeout(timeout);
     return this;
   }
 
-  
   /**
    * Set the minimum number of connections to keep available at all times.
-   * When the pool is created, it will create this many connections. 
+   * When the pool is created, it will create this many connections.
    * If <code>0</code> then connections will not be made until an actual operation
    * is done that requires client-to-server communication.
+   *
    * @param minConnections the initial number of connections
-   * this pool will create.
+   *                       this pool will create.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>minConnections</code>
-   * is less than <code>0</code>.
+   *                                  is less than <code>0</code>.
    */
   public ClientCacheFactory setPoolMinConnections(int minConnections) {
     getPoolFactory().setMinConnections(minConnections);
     return this;
   }
 
-  
   /**
-   * Set the max number of client to server connections that the pool will create. If all of 
+   * Set the max number of client to server connections that the pool will create. If all of
    * the connections are in use, an operation requiring a client to server connection
    * will block until a connection is available.
-   * @see #setPoolFreeConnectionTimeout(int) 
+   *
    * @param maxConnections the maximum number of connections in the pool.
-   * this pool will create. -1 indicates that there is no maximum number of connections
+   *                       this pool will create. -1 indicates that there is no maximum number of connections
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>maxConnections</code>
-   * is less than <code>minConnections</code>.
+   *                                  is less than <code>minConnections</code>.
+   * @see #setPoolFreeConnectionTimeout(int)
    */
   public ClientCacheFactory setPoolMaxConnections(int maxConnections) {
     getPoolFactory().setMaxConnections(maxConnections);
     return this;
   }
 
-  
   /**
    * Set the amount of time a connection can be idle before expiring the connection.
-   * If the pool size is greater than the minimum specified by 
+   * If the pool size is greater than the minimum specified by
    * {@link #setPoolMinConnections(int)}, connections which have been idle
-   * for longer than the idleTimeout will be closed. 
+   * for longer than the idleTimeout will be closed.
+   *
    * @param idleTimeout The amount of time in milliseconds that an idle connection
-   * should live before expiring. -1 indicates that connections should never expire.
+   *                    should live before expiring. -1 indicates that connections should never expire.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>idleTimout</code>
-   * is less than <code>-1</code>.
+   *                                  is less than <code>-1</code>.
    */
   public ClientCacheFactory setPoolIdleTimeout(long idleTimeout) {
     getPoolFactory().setIdleTimeout(idleTimeout);
     return this;
   }
 
-  
   /**
    * Set the number of times to retry a request after timeout/exception.
-   * @param retryAttempts The number of times to retry a request 
-   * after timeout/exception. -1 indicates that a request should be 
-   * tried against every available server before failing
+   *
+   * @param retryAttempts The number of times to retry a request
+   *                      after timeout/exception. -1 indicates that a request should be
+   *                      tried against every available server before failing
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>idleTimout</code>
-   * is less than <code>-1</code>.
+   *                                  is less than <code>-1</code>.
    */
   public ClientCacheFactory setPoolRetryAttempts(int retryAttempts) {
     getPoolFactory().setRetryAttempts(retryAttempts);
     return this;
   }
 
-  
   /**
    * How often to ping servers to verify that they are still alive. Each
    * server will be sent a ping every pingInterval if there has not
    * been any other communication with the server.
-   * 
+   * <p>
    * These pings are used by the server to monitor the health of
-   * the client. Make sure that the pingInterval is less than the 
+   * the client. Make sure that the pingInterval is less than the
    * maximum time between pings allowed by the cache server.
+   *
    * @param pingInterval The amount of time in milliseconds between
-   * pings.
+   *                     pings.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>pingInterval</code>
-   * is less than or equal to <code>0</code>.
+   *                                  is less than or equal to <code>0</code>.
    * @see CacheServer#setMaximumTimeBetweenPings(int)
    */
   public ClientCacheFactory setPoolPingInterval(long pingInterval) {
@@ -417,29 +422,28 @@ public class ClientCacheFactory {
     return this;
   }
 
-
   /**
    * How often to send client statistics to the server.
    * Doing this allows <code>gfmon</code> to monitor clients.
    * <p>A value of <code>-1</code> disables the sending of client statistics
    * to the server.
-   * 
+   *
    * @param statisticInterval The amount of time in milliseconds between
-   * sends of client statistics to the server.
+   *                          sends of client statistics to the server.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>statisticInterval</code>
-   * is less than <code>-1</code>.
+   *                                  is less than <code>-1</code>.
    */
   public ClientCacheFactory setPoolStatisticInterval(int statisticInterval) {
     getPoolFactory().setStatisticInterval(statisticInterval);
     return this;
   }
 
-
   /**
    * Configures the group that all servers this pool connects to must belong to.
+   *
    * @param group the server group that this pool will connect to.
-   * If <code>null</code> or <code>""</code> then all servers will be connected to.
+   *              If <code>null</code> or <code>""</code> then all servers will be connected to.
    * @return a reference to <code>this</code>
    */
   public ClientCacheFactory setPoolServerGroup(String group) {
@@ -447,7 +451,6 @@ public class ClientCacheFactory {
     return this;
   }
 
-
   /**
    * Add a locator, given its host and port, to this factory.
    * The locator must be a server locator and will be used to discover other running
@@ -456,19 +459,19 @@ public class ClientCacheFactory {
    * the locator will still be added. When the pool is used for
    * an operation if the host is still unknown an exception will
    * be thrown.
+   *
    * @param host the host name or ip address that the locator is listening on.
    * @param port the port that the locator is listening on
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if port is outside
-   * the valid range of [0..65535] inclusive.
-   * @throws IllegalStateException if a server has already been {@link #addPoolServer added} to this factory.
+   *                                  the valid range of [0..65535] inclusive.
+   * @throws IllegalStateException    if a server has already been {@link #addPoolServer added} to this factory.
    */
   public ClientCacheFactory addPoolLocator(String host, int port) {
     getPoolFactory().addLocator(host, port);
     return this;
   }
 
-
   /**
    * Add a server, given its host and port, to this factory.
    * The server must be a cache server and this client will
@@ -477,24 +480,25 @@ public class ClientCacheFactory {
    * the server will still be added. When the pool is used for
    * an operation if the host is still unknown an exception will
    * be thrown.
+   *
    * @param host the host name or ip address that the server is listening on.
    * @param port the port that the server is listening on
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if port is outside
-   * the valid range of [0..65535] inclusive.
-   * @throws IllegalStateException if a locator has already been {@link #addPoolLocator added} to this factory.
+   *                                  the valid range of [0..65535] inclusive.
+   * @throws IllegalStateException    if a locator has already been {@link #addPoolLocator added} to this factory.
    */
   public ClientCacheFactory addPoolServer(String host, int port) {
     getPoolFactory().addServer(host, port);
     return this;
   }
 
-
   /**
    * If set to <code>true</code> then the created pool will have server-to-client
    * subscriptions enabled.
    * If set to <code>false</code> then all <code>Subscription*</code> attributes
    * are ignored at create time.
+   *
    * @return a reference to <code>this</code>
    */
   public ClientCacheFactory setPoolSubscriptionEnabled(boolean enabled) {
@@ -502,17 +506,17 @@ public class ClientCacheFactory {
     return this;
   }
 
-  
   /**
    * Sets the redundancy level for this pools server-to-client subscriptions.
    * If <code>0</code> then no redundant copies will be kept on the servers.
    * Otherwise an effort will be made to maintain the requested number of
    * copies of the server-to-client subscriptions. At most one copy per server will
    * be made up to the requested level.
+   *
    * @param redundancy the number of redundant servers for this client's subscriptions.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>redundancyLevel</code>
-   * is less than <code>-1</code>.
+   *                                  is less than <code>-1</code>.
    */
   public ClientCacheFactory setPoolSubscriptionRedundancy(int redundancy) {
     getPoolFactory().setSubscriptionRedundancy(redundancy);
@@ -525,34 +529,33 @@ public class ClientCacheFactory {
    * to minimize duplicate events.
    * Entries that have not been modified for this amount of time
    * are expired from the list
+   *
    * @param messageTrackingTimeout number of milliseconds to set the timeout to.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>messageTrackingTimeout</code>
-   * is less than or equal to <code>0</code>.
+   *                                  is less than or equal to <code>0</code>.
    */
   public ClientCacheFactory setPoolSubscriptionMessageTrackingTimeout(int messageTrackingTimeout) {
     getPoolFactory().setSubscriptionMessageTrackingTimeout(messageTrackingTimeout);
     return this;
   }
 
-  
   /**
    * Sets the interval in milliseconds
    * to wait before sending acknowledgements to the cache server for
    * events received from the server subscriptions.
-   * 
+   *
    * @param ackInterval number of milliseconds to wait before sending event
-   * acknowledgements.
+   *                    acknowledgements.
    * @return a reference to <code>this</code>
    * @throws IllegalArgumentException if <code>ackInterval</code>
-   * is less than or equal to <code>0</code>.
+   *                                  is less than or equal to <code>0</code>.
    */
   public ClientCacheFactory setPoolSubscriptionAckInterval(int ackInterval) {
     getPoolFactory().setSubscriptionAckInterval(ackInterval);
     return this;
   }
 
-
   /**
    * By default setPRSingleHopEnabled is <code>true</code>
    * in which case the client is aware of the location of partitions on servers hosting
@@ -561,7 +564,7 @@ public class ClientCacheFactory {
    * Using this information, the client routes the client cache operations
    * directly to the server which is hosting the required partition for the
    * cache operation using a single network hop.
-   * This mode works best 
+   * This mode works best
    * when {@link #setPoolMaxConnections(int)} is set
    * to <code>-1</code> which is the default.
    * This mode causes the client to have more connections to the servers.
@@ -571,11 +574,11 @@ public class ClientCacheFactory {
    * The client will use fewer network connections to the servers.
    * <p>
    * Caution: for {@link com.gemstone.gemfire.cache.DataPolicy#PARTITION partition} regions
-   *  with
+   * with
    * {@link com.gemstone.gemfire.cache.PartitionAttributesFactory#setLocalMaxMemory(int) local-max-memory}
    * equal to zero, no cache operations mentioned above will be routed to those
    * servers as they do not host any partitions.
-   * 
+   *
    * @return the newly created pool.
    */
   public ClientCacheFactory setPoolPRSingleHopEnabled(boolean enabled) {
@@ -583,14 +586,13 @@ public class ClientCacheFactory {
     return this;
   }
 
-
   /**
    * If set to <code>true</code> then the created pool can be used by multiple
    * users. <br>
    * <br>
    * Note: If set to true, all the client side regions must be
    * {@link ClientRegionShortcut#PROXY proxies}. No client side storage is allowed.
-   * 
+   *
    * @return a reference to <code>this</code>
    */
   public ClientCacheFactory setPoolMultiuserAuthentication(boolean enabled) {
@@ -598,20 +600,23 @@ public class ClientCacheFactory {
     return this;
   }
 
-
-  /** Returns the version of the cache implementation.
+  /**
+   * Returns the version of the cache implementation.
+   *
    * @return the version of the cache implementation as a <code>String</code>
    */
   public static String getVersion() {
     return GemFireVersion.getGemFireVersion();
   }
+
   /**
    * Gets an arbitrary open instance of {@link ClientCache} produced by an
    * earlier call to {@link #create}.
-   * @throws CacheClosedException if a cache has not been created
-   * or the only created one is {@link ClientCache#isClosed closed}
+   *
+   * @throws CacheClosedException  if a cache has not been created
+   *                               or the only created one is {@link ClientCache#isClosed closed}
    * @throws IllegalStateException if the cache was created by CacheFactory instead
-   * of ClientCacheFactory
+   *                               of ClientCacheFactory
    */
   public static synchronized ClientCache getAnyInstance() {
     GemFireCacheImpl instance = GemFireCacheImpl.getInstance();
@@ -625,15 +630,16 @@ public class ClientCacheFactory {
       return instance;
     }
   }
-  
-  /** Sets the object preference to PdxInstance type.
+
+  /**
+   * Sets the object preference to PdxInstance type.
    * When a cached object that was serialized as a PDX is read
    * from the cache a {@link PdxInstance} will be returned instead of the actual domain class.
-   * The PdxInstance is an interface that provides run time access to 
-   * the fields of a PDX without deserializing the entire PDX. 
-   * The PdxInstance implementation is a light weight wrapper 
-   * that simply refers to the raw bytes of the PDX that are kept 
-   * in the cache. Using this method applications can choose to 
+   * The PdxInstance is an interface that provides run time access to
+   * the fields of a PDX without deserializing the entire PDX.
+   * The PdxInstance implementation is a light weight wrapper
+   * that simply refers to the raw bytes of the PDX that are kept
+   * in the cache. Using this method applications can choose to
    * access PdxInstance instead of Java object.
    * <p>Note that a PdxInstance is only returned if a serialized PDX is found in the cache.
    * If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance.
@@ -647,11 +653,12 @@ public class ClientCacheFactory {
     this.cacheConfig.setPdxReadSerialized(pdxReadSerialized);
     return this;
   }
-  
+
   /**
    * Set the PDX serializer for the cache. If this serializer is set,
-   * it will be consulted to see if it can serialize any domain classes which are 
-   * added to the cache in portable data exchange format. 
+   * it will be consulted to see if it can serialize any domain classes which are
+   * added to the cache in portable data exchange format.
+   *
    * @param serializer the serializer to use
    * @return this ClientCacheFactory
    * @since GemFire 6.6
@@ -661,16 +668,17 @@ public class ClientCacheFactory {
     this.cacheConfig.setPdxSerializer(serializer);
     return this;
   }
-  
+
   /**
    * Set the disk store that is used for PDX meta data. When
    * serializing objects in the PDX format, the type definitions
    * are persisted to disk. This setting controls which disk store
    * is used for that persistence.
-   * 
+   * <p>
    * If not set, the metadata will go in the default disk store.
+   *
    * @param diskStoreName the name of the disk store to use
-   * for the PDX metadata.
+   *                      for the PDX metadata.
    * @return this ClientCacheFactory
    * @since GemFire 6.6
    */
@@ -681,10 +689,10 @@ public class ClientCacheFactory {
 
   /**
    * Control whether the type metadata for PDX objects is persisted to disk.
-   * The default for this setting is false. 
+   * The default for this setting is false.
    * If you are using persistent regions with PDX then you must set this to true.
    * If you are using a WAN gateway with PDX then you should set this to true.
-   * 
+   *
    * @param isPersistent true if the metadata should be persistent
    * @return this ClientCacheFactory
    * @since GemFire 6.6
@@ -693,6 +701,7 @@ public class ClientCacheFactory {
     this.cacheConfig.setPdxPersistent(isPersistent);
     return this;
   }
+
   /**
    * Control whether pdx ignores fields that were unread during deserialization.
    * The default is to preserve unread fields be including their data during serialization.
@@ -700,10 +709,10 @@ public class ClientCacheFactory {
    * during serialization.
    * <P>You should only set this attribute to <code>true</code> if you know this member
    * will only be reading cache data. In this use case you do not need to pay the cost
-   * of preserving the unread fields since you will never be reserializing pdx data. 
-   * 
+   * of preserving the unread fields since you will never be reserializing pdx data.
+   *
    * @param ignore <code>true</code> if fields not read during pdx deserialization should be ignored;
-   * <code>false</code>, the default, if they should be preserved.
+   *               <code>false</code>, the default, if they should be preserved.
    * @return this ClientCacheFactory
    * @since GemFire 6.6
    */
@@ -711,5 +720,5 @@ public class ClientCacheFactory {
     this.cacheConfig.setPdxIgnoreUnreadFields(ignore);
     return this;
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/690ca40b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/PoolImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/PoolImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/PoolImpl.java
index 44465d8..b9f25d7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/PoolImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/client/internal/PoolImpl.java
@@ -668,7 +668,7 @@ public class PoolImpl implements InternalPool {
     }
     if (!getLocators().equals(other.getLocators())) {
       throw new RuntimeException(
-          LocalizedStrings.PoolImpl_0_ARE_DIFFERENT.toLocalizedString(LOCATORS));
+          LocalizedStrings.PoolImpl_0_ARE_DIFFERENT.toLocalizedString("locators"));
     }
     if (!getServers().equals(other.getServers())) {
       throw new RuntimeException(

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/690ca40b/geode-core/src/main/java/com/gemstone/gemfire/distributed/SystemConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/SystemConfigurationProperties.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/SystemConfigurationProperties.java
index df320b2..b4526fa 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/SystemConfigurationProperties.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/SystemConfigurationProperties.java
@@ -17,9 +17,6 @@
 package com.gemstone.gemfire.distributed;
 
 
-/**
- * Created by ukohlmeyer on 26/05/2016.
- */
 public interface SystemConfigurationProperties {
   String ACK_SEVERE_ALERT_THRESHOLD = "ack-severe-alert-threshold";
   String ACK_WAIT_THRESHOLD = "ack-wait-threshold";

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/690ca40b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
index 1cce999..9a900ca 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DistributionConfig.java
@@ -2457,8 +2457,8 @@ public interface DistributionConfig extends Config, LogConfig, SystemConfigurati
   String KEY_STORE_TYPE_NAME = ".keyStoreType";
   String KEY_STORE_NAME = ".keyStore";
   String KEY_STORE_PASSWORD_NAME = ".keyStorePassword";
-  String TRUST_STORE_NAME = "trustStore";
-  String TRUST_STORE_PASSWORD_NAME = "trustStorePassword";
+  String TRUST_STORE_NAME = ".trustStore";
+  String TRUST_STORE_PASSWORD_NAME = ".trustStorePassword";
 
   /**
    * Suffix for ssl keystore and trust store properties for JMX

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/690ca40b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
index 615823c..bcbd035 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
@@ -22,7 +22,6 @@ import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
@@ -79,12 +78,13 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     return cache;
   }
 
-  private void createServer() throws IOException{
-    cacheServerPort = AvailablePortHelper.getRandomAvailableTCPPort();
+  private int createServer() throws IOException{
     cacheServer = cache.addCacheServer();
-    cacheServer.setPort(cacheServerPort);
+    cacheServer.setPort(0);
     cacheServer.start();
     hostName = cacheServer.getHostnameForClients();
+    cacheServerPort = cacheServer.getPort();
+    return cacheServerPort;
   }
 
   public int getCacheServerPort(){
@@ -143,15 +143,10 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     String keyStorePath = TestUtil.getResourcePath(CacheServerSSLConnectionDUnitTest.class, keyStore);
     String trustStorePath = TestUtil.getResourcePath(CacheServerSSLConnectionDUnitTest.class, trustStore);
     //using new server-ssl-* properties
-    gemFireProps.put(SERVER_SSL_ENABLED,
-            String.valueOf(cacheServerSslenabled));
-    gemFireProps.put(SERVER_SSL_PROTOCOLS,
-            cacheServerSslprotocols);
-    gemFireProps.put(SERVER_SSL_CIPHERS,
-            cacheServerSslciphers);
-    gemFireProps.put(
-            SERVER_SSL_REQUIRE_AUTHENTICATION,
-            String.valueOf(cacheServerSslRequireAuth));
+    gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
+    gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
+    gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
+    gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));
 
     gemFireProps.put(SERVER_SSL_KEYSTORE_TYPE, "jks");
     gemFireProps.put(SERVER_SSL_KEYSTORE, keyStorePath);
@@ -191,8 +186,8 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     instance.setUpServerVM(cacheServerSslenabled);
   }
 
-  public static void createServerTask() throws Exception {
-    instance.createServer();
+  public static int createServerTask() throws Exception {
+    return instance.createServer();
   }
 
   public static void setUpClientVMTask(String host, int port,
@@ -245,11 +240,9 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     boolean cacheClientSslRequireAuth = true;
 
     serverVM.invoke(() -> setUpServerVMTask(cacheServerSslenabled));
-    serverVM.invoke(() -> createServerTask());
+    int port = serverVM.invoke(() -> createServerTask());
 
-    Object array[] = (Object[])serverVM.invoke(() -> getCacheServerEndPointTask());
-    String hostName = (String)array[0];
-    int port = (Integer) array[1];
+    String hostName = host.getHostName();
 
     clientVM.invoke(() -> setUpClientVMTask(hostName, port, cacheClientSslenabled, cacheClientSslRequireAuth, CLIENT_KEY_STORE, CLIENT_TRUST_STORE));
     clientVM.invoke(() -> doClientRegionTestTask());


Mime
View raw message