You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/12/07 19:30:14 UTC

incubator-tinkerpop git commit: TINKERPOP-1018 Fixed some settings that weren't being passed to Gremlin Driver Cluster creation through config file.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 8ab1bd38f -> 43b790dd1


TINKERPOP-1018 Fixed some settings that weren't being passed to Gremlin Driver Cluster creation through config file.

There were more than just maxContentLength as defined in the issue.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/43b790dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/43b790dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/43b790dd

Branch: refs/heads/master
Commit: 43b790dd1c8cdd346dded070d3727faf35945afc
Parents: 8ab1bd3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Dec 7 13:29:01 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Dec 7 13:29:01 2015 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../tinkerpop/gremlin/driver/Cluster.java       | 24 ++++++++++++++++++++
 .../tinkerpop/gremlin/driver/Settings.java      | 17 ++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/43b790dd/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 9b3fa71..0ebff5e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -27,6 +27,7 @@ TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 * Improved logging control during builds with Maven.
+* Fixed settings that weren't being passed to the the Gremlin Driver `Cluster` through configuration file.
 * `Column` now implements `Function` and now `by(valueDecr)` can  be replaced with `by(values,decr)` and thus, projection and order are now separated.
 * `Column` now implements `Function`. The modulator `by(valueDecr)` can be replaced by `by(values,decr)` and thus, projection and order are separated.
 * Added `InputRDDFormat` which wraps an `InputRDD` to make it accessible to Hadoop and not just Spark.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/43b790dd/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index 7d83c58..ddc6081 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -26,6 +26,7 @@ import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
 
+import javax.net.ssl.TrustManager;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -122,9 +123,17 @@ public final class Cluster {
         final Builder builder = new Builder(settings.hosts.get(0))
                 .port(settings.port)
                 .enableSsl(settings.connectionPool.enableSsl)
+                .trustCertificateChainFile(settings.connectionPool.trustCertChainFile)
                 .nioPoolSize(settings.nioPoolSize)
                 .workerPoolSize(settings.workerPoolSize)
+                .reconnectInterval(settings.connectionPool.reconnectInterval)
+                .reconnectIntialDelay(settings.connectionPool.reconnectInitialDelay)
+                .resultIterationBatchSize(settings.connectionPool.resultIterationBatchSize)
+                .channelizer(settings.connectionPool.channelizer)
+                .maxContentLength(settings.connectionPool.maxContentLength)
+                .maxWaitForConnection(settings.connectionPool.maxWaitForConnection)
                 .maxInProcessPerConnection(settings.connectionPool.maxInProcessPerConnection)
+                .minInProcessPerConnection(settings.connectionPool.minInProcessPerConnection)
                 .maxSimultaneousUsagePerConnection(settings.connectionPool.maxSimultaneousUsagePerConnection)
                 .minSimultaneousUsagePerConnection(settings.connectionPool.minSimultaneousUsagePerConnection)
                 .maxConnectionPoolSize(settings.connectionPool.maxSize)
@@ -133,6 +142,9 @@ public final class Cluster {
         if (settings.username != null && settings.password != null)
             builder.credentials(settings.username, settings.password);
 
+        if (settings.jaasEntry != null)
+            builder.jaasEntry(settings.jaasEntry);
+
         // the first address was added above in the constructor, so skip it if there are more
         if (addresses.size() > 1)
             addresses.stream().skip(1).forEach(builder::addContactPoint);
@@ -249,6 +261,7 @@ public final class Cluster {
         private int resultIterationBatchSize = Connection.RESULT_ITERATION_BATCH_SIZE;
         private String channelizer = Channelizer.WebSocketChannelizer.class.getName();
         private boolean enableSsl = false;
+        private String trustCertChainFile = null;
         private LoadBalancingStrategy loadBalancingStrategy = new LoadBalancingStrategy.RoundRobin();
         private AuthProperties authProps = new AuthProperties();
 
@@ -316,6 +329,16 @@ public final class Cluster {
         }
 
         /**
+         * File location for a SSL Certificate Chain to use when SSL is enabled. If this value is not provided and
+         * SSL is enabled, the {@link TrustManager} will be established with a self-signed certificate which is NOT
+         * suitable for production purposes.
+         */
+        public Builder trustCertificateChainFile(final String certificateChainFile) {
+            this.trustCertChainFile = certificateChainFile;
+            return this;
+        }
+
+        /**
          * The minimum number of in-flight requests that can occur on a {@link Connection} before it is considered
          * for closing on return to the {@link ConnectionPool}.
          */
@@ -528,6 +551,7 @@ public final class Cluster {
             connectionPoolSettings.reconnectInterval = this.reconnectInterval;
             connectionPoolSettings.resultIterationBatchSize = this.resultIterationBatchSize;
             connectionPoolSettings.enableSsl = this.enableSsl;
+            connectionPoolSettings.trustCertChainFile = this.trustCertChainFile;
             connectionPoolSettings.channelizer = this.channelizer;
             return new Cluster(getContactPoints(), serializer, this.nioPoolSize, this.workerPoolSize,
                     connectionPoolSettings, loadBalancingStrategy, authProps);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/43b790dd/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index 07f3294..7faa377 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@ -47,9 +47,11 @@ final class Settings {
 
     public int workerPoolSize = Runtime.getRuntime().availableProcessors() * 2;
 
-    public String username;
+    public String username = null;
 
-    public String password;
+    public String password = null;
+
+    public String jaasEntry = null;
 
     /**
      * Read configuration from a file into a new {@link Settings} object.
@@ -84,8 +86,19 @@ final class Settings {
         public int reconnectInitialDelay = Connection.RECONNECT_INITIAL_DELAY;
         public int resultIterationBatchSize = Connection.RESULT_ITERATION_BATCH_SIZE;
         public String channelizer = Channelizer.WebSocketChannelizer.class.getName();
+
+        /**
+         * @deprecated as of 3.1.1-incubating, and not replaced as this property was never implemented internally
+         * as the way to establish sessions
+         */
+        @Deprecated
         public String sessionId = null;
 
+        /**
+         * @deprecated as of 3.1.1-incubating, and not replaced as this property was never implemented internally
+         * as the way to establish sessions
+         */
+        @Deprecated
         public Optional<String> optionalSessionId() {
             return Optional.ofNullable(sessionId);
         }