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 2016/08/12 19:34:52 UTC
tinkerpop git commit: TINKERPOP-1334 Added getter methods for Cluster
settings on driver.
Repository: tinkerpop
Updated Branches:
refs/heads/master 1799fa461 -> 5d87d279f
TINKERPOP-1334 Added getter methods for Cluster settings on driver.
This was a simple change that provided a way to read settings out of the Cluster once they were set. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5d87d279
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5d87d279
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5d87d279
Branch: refs/heads/master
Commit: 5d87d279f2e142d25a4f92991b1caa5700c9b821
Parents: 1799fa4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Aug 12 15:33:36 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Aug 12 15:33:36 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../tinkerpop/gremlin/driver/Cluster.java | 154 ++++++++++++++++++-
2 files changed, 151 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d87d279/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8232065..bff6907 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -30,6 +30,7 @@ TinkerPop 3.2.2 (NOT OFFICIALLY RELEASED YET)
* Added new recipe for "Traversal Induced Values".
* Fixed a potential leak of a `ReferenceCounted` resource in Gremlin Server.
* Added class registrations for `Map.Entry` implementations to `GryoMapper`.
+* Added methods to retrieve `Cluster` settings in `gremlin-driver`.
* Fixed a severe bug in `SubgraphStrategy`.
* Deprecated `SubgraphStrategy.Builder.vertexCriterion()/edgeCriterion()` in favor of `vertices()/edges()`.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d87d279/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 32600a2..c7ea041 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
@@ -266,6 +266,148 @@ public final class Cluster {
.collect(Collectors.toList()));
}
+ /**
+ * Size of the pool for handling request/response operations.
+ */
+ public int getNioPoolSize() {
+ return manager.nioPoolSize;
+ }
+
+ /**
+ * Size of the pool for handling background work.
+ */
+ public int getWorkerPoolSize() {
+ return manager.workerPoolSize;
+ }
+
+ /**
+ * Get the {@link MessageSerializer} MIME types supported.
+ */
+ public String[] getSerializers() {
+ return getSerializer().mimeTypesSupported();
+ }
+
+ /**
+ * Determines if connectivity over SSL is enabled.
+ */
+ public boolean isSslEnabled() {
+ return manager.connectionPoolSettings.enableSsl;
+ }
+
+ /**
+ * Gets 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}.
+ */
+ public int getMinInProcessPerConnection() {
+ return manager.connectionPoolSettings.minInProcessPerConnection;
+ }
+
+ /**
+ * Gets the maximum number of in-flight requests that can occur on a {@link Connection}.
+ */
+ public int getMaxInProcessPerConnection() {
+ return manager.connectionPoolSettings.maxInProcessPerConnection;
+ }
+
+ /**
+ * Gets the maximum number of times that a {@link Connection} can be borrowed from the pool simultaneously.
+ */
+ public int maxSimultaneousUsagePerConnection() {
+ return manager.connectionPoolSettings.maxSimultaneousUsagePerConnection;
+ }
+
+ /**
+ * Gets the minimum number of times that a {@link Connection} should be borrowed from the pool before it falls
+ * under consideration for closing.
+ */
+ public int minSimultaneousUsagePerConnection() {
+ return manager.connectionPoolSettings.minSimultaneousUsagePerConnection;
+ }
+
+ /**
+ * Gets the maximum size that the {@link ConnectionPool} can grow.
+ */
+ public int maxConnectionPoolSize() {
+ return manager.connectionPoolSettings.maxSize;
+ }
+
+ /**
+ * Gets the minimum size of the {@link ConnectionPool}.
+ */
+ public int minConnectionPoolSize() {
+ return manager.connectionPoolSettings.minSize;
+ }
+
+ /**
+ * Gets the override for the server setting that determines how many results are returned per batch.
+ */
+ public int getResultIterationBatchSize() {
+ return manager.connectionPoolSettings.resultIterationBatchSize;
+ }
+
+ /**
+ * Gets the maximum amount of time to wait for a connection to be borrowed from the connection pool.
+ */
+ public int getMaxWaitForConnection() {
+ return manager.connectionPoolSettings.maxWaitForConnection;
+ }
+
+ /**
+ * Gets how long a session will stay open assuming the current connection actually is configured for their use.
+ */
+ public int getMaxWaitForSessionClose() {
+ return manager.connectionPoolSettings.maxWaitForSessionClose;
+ }
+
+ /**
+ * Gets the maximum size in bytes of any request sent to the server.
+ */
+ public int getMaxContentLength() {
+ return manager.connectionPoolSettings.maxContentLength;
+ }
+
+ /**
+ * Gets the {@link Channelizer} implementation to use on the client when creating a {@link Connection}.
+ */
+ public String getChannelizer() {
+ return manager.connectionPoolSettings.channelizer;
+ }
+
+ /**
+ * Gets time in milliseconds to wait before attempting to reconnect to a dead host after it has been marked dead.
+ */
+ public int getReconnectIntialDelay() {
+ return manager.connectionPoolSettings.reconnectInitialDelay;
+ }
+
+ /**
+ * Gets time in milliseconds to wait between retries when attempting to reconnect to a dead host.
+ */
+ public int getReconnectInterval() {
+ return manager.connectionPoolSettings.reconnectInterval;
+ }
+
+ /**
+ * Specifies the load balancing strategy to use on the client side.
+ */
+ public Class<? extends LoadBalancingStrategy> getLoadBalancingStrategy() {
+ return manager.loadBalancingStrategy.getClass();
+ }
+
+ /**
+ * Gets the port that the Gremlin Servers will be listening on.
+ */
+ public int getPort() {
+ return manager.port;
+ }
+
+ /**
+ * Gets a list of all the configured hosts.
+ */
+ public Collection<Host> allHosts() {
+ return Collections.unmodifiableCollection(manager.allHosts());
+ }
+
Factory getFactory() {
return manager.factory;
}
@@ -290,10 +432,6 @@ public final class Cluster {
return manager.authProps;
}
- Collection<Host> allHosts() {
- return manager.allHosts();
- }
-
SslContext createSSLContext() throws Exception {
// if the context is provided then just use that and ignore the other settings
if (manager.sslContextOptional.isPresent()) return manager.sslContextOptional.get();
@@ -704,6 +842,10 @@ public final class Cluster {
private final ScheduledExecutorService executor;
+ private final int nioPoolSize;
+ private final int workerPoolSize;
+ private final int port;
+
private final AtomicReference<CompletableFuture<Void>> closeFuture = new AtomicReference<>();
private Manager(final Builder builder) {
@@ -733,6 +875,10 @@ public final class Cluster {
sslContextOptional = Optional.ofNullable(builder.sslContext);
+ nioPoolSize = builder.nioPoolSize;
+ workerPoolSize = builder.workerPoolSize;
+ port = builder.port;
+
this.factory = new Factory(builder.nioPoolSize);
this.serializer = builder.serializer;
this.executor = Executors.newScheduledThreadPool(builder.workerPoolSize,