Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AB584200B7E for ; Mon, 22 Aug 2016 22:39:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AA1A2160AC7; Mon, 22 Aug 2016 20:39:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 78EA7160ACB for ; Mon, 22 Aug 2016 22:39:47 +0200 (CEST) Received: (qmail 97910 invoked by uid 500); 22 Aug 2016 20:39:46 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 97699 invoked by uid 99); 22 Aug 2016 20:39:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Aug 2016 20:39:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7BF2DE09B4; Mon, 22 Aug 2016 20:39:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.apache.org Date: Mon, 22 Aug 2016 20:39:59 -0000 Message-Id: <8055b497f4ba4e609ea6b6c00d968734@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [14/48] tinkerpop git commit: TINKERPOP-1334 Added getter methods for Cluster settings on driver. archived-at: Mon, 22 Aug 2016 20:39:49 -0000 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/TINKERPOP-1278 Commit: 5d87d279f2e142d25a4f92991b1caa5700c9b821 Parents: 1799fa4 Author: Stephen Mallette Authored: Fri Aug 12 15:33:36 2016 -0400 Committer: Stephen Mallette 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 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 allHosts() { + return Collections.unmodifiableCollection(manager.allHosts()); + } + Factory getFactory() { return manager.factory; } @@ -290,10 +432,6 @@ public final class Cluster { return manager.authProps; } - Collection 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> 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,