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/11/30 17:11:35 UTC
[1/7] incubator-tinkerpop git commit: Refactored the
StandardOpProcessor to be more flexibile for extenders.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 27d82539e -> 85c50c194
Refactored the StandardOpProcessor to be more flexibile for extenders.
Made it so that extending classes don't need to override evalOp and made it so that they can re-use the binding maker as needed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/5cb59119
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/5cb59119
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/5cb59119
Branch: refs/heads/master
Commit: 5cb591196c8c4b34d6f7d85c736f2c9e985f8287
Parents: df887ac
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 26 09:44:06 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Nov 26 09:44:06 2015 -0500
----------------------------------------------------------------------
.../server/op/AbstractEvalOpProcessor.java | 6 ++--
.../server/op/standard/StandardOpProcessor.java | 35 +++++++++++++++-----
2 files changed, 30 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5cb59119/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
index 9c5c9c9..5071429 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/AbstractEvalOpProcessor.java
@@ -142,7 +142,7 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
* {@link GremlinExecutor#eval} method.
*/
protected void evalOpInternal(final Context context, final Supplier<GremlinExecutor> gremlinExecutorSupplier,
- final BindingSupplier<Bindings> bindingsSupplier) throws OpProcessorException {
+ final BindingSupplier bindingsSupplier) throws OpProcessorException {
final Timer.Context timerContext = evalOpTimer.time();
final ChannelHandlerContext ctx = context.getChannelHandlerContext();
final RequestMessage msg = context.getRequestMessage();
@@ -279,7 +279,7 @@ public abstract class AbstractEvalOpProcessor implements OpProcessor {
}
@FunctionalInterface
- public interface BindingSupplier<T> {
- public T get() throws OpProcessorException;
+ public interface BindingSupplier {
+ public Bindings get() throws OpProcessorException;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5cb59119/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java
index c54cbad..3923548 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/standard/StandardOpProcessor.java
@@ -34,9 +34,10 @@ import org.slf4j.LoggerFactory;
import javax.script.Bindings;
import javax.script.SimpleBindings;
-import java.io.IOException;
import java.util.Map;
import java.util.Optional;
+import java.util.function.Function;
+import java.util.function.Supplier;
/**
* Simple {@link OpProcessor} implementation that handles {@code ScriptEngine} script evaluation outside the context
@@ -48,8 +49,11 @@ public class StandardOpProcessor extends AbstractEvalOpProcessor {
private static final Logger logger = LoggerFactory.getLogger(StandardOpProcessor.class);
public static final String OP_PROCESSOR_NAME = "";
+ protected final Function<Context, BindingSupplier> bindingMaker;
+
public StandardOpProcessor() {
- super(true);
+ super(true);
+ bindingMaker = getBindingMaker();
}
@Override
@@ -73,11 +77,24 @@ public class StandardOpProcessor extends AbstractEvalOpProcessor {
}
private void evalOp(final Context context) throws OpProcessorException {
- final RequestMessage msg = context.getRequestMessage();
+ if (logger.isDebugEnabled()) {
+ final RequestMessage msg = context.getRequestMessage();
+ logger.debug("Sessionless request {} for eval in thread {}", msg.getRequestId(), Thread.currentThread().getName());
+ }
- logger.debug("Sessionless request {} for eval in thread {}", msg.getRequestId(), Thread.currentThread().getName());
+ evalOpInternal(context, context::getGremlinExecutor, bindingMaker.apply(context));
+ }
- super.evalOpInternal(context, context::getGremlinExecutor, () -> {
+ /**
+ * A useful method for those extending this class, where the means for binding construction can be supplied
+ * to this class. This function is used in {@link #evalOp(Context)} to create the final argument to
+ * {@link super#evalOpInternal(Context, Supplier, BindingSupplier)}. In this way an extending class can use
+ * the default {@link BindingSupplier} which carries a lot of re-usable functionality or provide a new one to
+ * override the existing approach.
+ */
+ protected Function<Context, BindingSupplier> getBindingMaker() {
+ return context -> () -> {
+ final RequestMessage msg = context.getRequestMessage();
final Bindings bindings = new SimpleBindings();
// don't allow both rebindings and aliases parameters as they are the same thing. aliases were introduced
@@ -87,7 +104,8 @@ public class StandardOpProcessor extends AbstractEvalOpProcessor {
final boolean hasAliases = msg.getArgs().containsKey(Tokens.ARGS_ALIASES);
if (hasRebindings && hasAliases) {
final String error = "Prefer use of the 'aliases' parameter over 'rebindings' and do not use both";
- throw new OpProcessorException(error, ResponseMessage.build(msg).code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).result(error).create());
+ throw new OpProcessorException(error, ResponseMessage.build(msg)
+ .code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).result(error).create());
}
final String rebindingOrAliasParameter = hasRebindings ? Tokens.ARGS_REBINDINGS : Tokens.ARGS_ALIASES;
@@ -114,7 +132,8 @@ public class StandardOpProcessor extends AbstractEvalOpProcessor {
if (!found) {
final String error = String.format("Could not alias [%s] to [%s] as [%s] not in the Graph or TraversalSource global bindings",
kv.getKey(), kv.getValue(), kv.getValue());
- throw new OpProcessorException(error, ResponseMessage.build(msg).code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).result(error).create());
+ throw new OpProcessorException(error, ResponseMessage.build(msg)
+ .code(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS).result(error).create());
}
}
}
@@ -122,6 +141,6 @@ public class StandardOpProcessor extends AbstractEvalOpProcessor {
// add any bindings to override any other supplied
Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS)).ifPresent(bindings::putAll);
return bindings;
- });
+ };
}
}
[5/7] incubator-tinkerpop git commit: GremlinServerExecutor includes
"hostOptions"
Posted by sp...@apache.org.
GremlinServerExecutor includes "hostOptions"
Added some deprecation to a GremlinServer constructor - opens a bad usage of GremlinServerExecutor. Added a way to get the internally constructed GremlinServerExecutor from GremlinServer. Included a hostOptions Map in GremlinServerExecutor that will make it possible for embedding applications to include objects that can be used by the Channelizer.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d4cd1dd2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d4cd1dd2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d4cd1dd2
Branch: refs/heads/master
Commit: d4cd1dd2868190b539a74741d17c59e6a0a0ada3
Parents: b007e83
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 27 09:58:24 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Nov 27 09:58:24 2015 -0500
----------------------------------------------------------------------
.../tinkerpop/gremlin/server/GremlinServer.java | 9 +++++-
.../server/util/ServerGremlinExecutor.java | 32 +++++++++++++++++---
2 files changed, 35 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d4cd1dd2/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
index 2104e2f..c2c18b7 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
@@ -86,7 +86,6 @@ public class GremlinServer {
logger.warn("cannot use epoll in non-linux env, falling back to NIO");
}
-
Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown"));
final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d");
@@ -114,7 +113,11 @@ public class GremlinServer {
* pre-constructed objects used by the server as well as the {@link Settings} object itself. This constructor
* is useful when Gremlin Server is being used in an embedded style and there is a need to share thread pools
* with the hosting application.
+ *
+ * @deprecated As of release 3.1.1-incubating, not replaced.
+ * @see <a href="https://issues.apache.org/jira/browse/TINKERPOP3-912">TINKERPOP3-912</a>
*/
+ @Deprecated
public GremlinServer(final ServerGremlinExecutor<EventLoopGroup> serverGremlinExecutor) {
this.serverGremlinExecutor = serverGremlinExecutor;
this.settings = serverGremlinExecutor.getSettings();
@@ -310,6 +313,10 @@ public class GremlinServer {
return serverStopped;
}
+ public ServerGremlinExecutor<EventLoopGroup> getServerGremlinExecutor() {
+ return serverGremlinExecutor;
+ }
+
public static void main(final String[] args) throws Exception {
// add to vm options: -Dlog4j.configuration=file:conf/log4j.properties
printHeader();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d4cd1dd2/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index fe3c9a5..3fa568c 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.server.util;
import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.server.Channelizer;
import org.apache.tinkerpop.gremlin.server.GraphManager;
import org.apache.tinkerpop.gremlin.server.GremlinServer;
import org.apache.tinkerpop.gremlin.server.Settings;
@@ -27,8 +28,11 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -37,11 +41,11 @@ import java.util.stream.Collectors;
/**
* The core of script execution in Gremlin Server. Given {@link Settings} and optionally other arguments, this
- * class will construct a {@link GremlinExecutor} to be used by Gremlin Server. Those expecting to build their
- * own version of Gremlin Server might consider coring their implementation with this class as it provides some
- * basic infrastructure required for most of Gremlin Server script processing features. Those embedding Gremlin
- * Server in another application might consider using this class to initialize the {@link GremlinServer} class
- * as it will allow sharing of thread pool resources.
+ * class will construct a {@link GremlinExecutor} to be used by Gremlin Server. A typical usage would be to
+ * instantiate the {@link GremlinServer} and then immediately call {@link GremlinServer#getServerGremlinExecutor()}
+ * which would allow the opportunity to assign "host options" which could be used by a custom {@link Channelizer}.
+ * Add these options before calling {@link GremlinServer#start()} to be sure the {@link Channelizer} gets access to
+ * those.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
@@ -56,6 +60,8 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
private final ExecutorService gremlinExecutorService;
private final GremlinExecutor gremlinExecutor;
+ private final Map<String,Object> hostOptions = new ConcurrentHashMap<>();
+
/**
* Create a new object from {@link Settings} where thread pools are internally created. Note that the
* {@code scheduleExecutorServiceClass} will be created via
@@ -138,6 +144,22 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
.collect(Collectors.toList());
}
+ public void addHostOption(final String key, final Object value) {
+ hostOptions.put(key, value);
+ }
+
+ public Map<String,Object> getHostOptions() {
+ return Collections.unmodifiableMap(hostOptions);
+ }
+
+ public Object removeHostOption(final String key) {
+ return hostOptions.remove(key);
+ }
+
+ public void clearHostOptions() {
+ hostOptions.clear();
+ }
+
public T getScheduledExecutorService() {
return scheduledExecutorService;
}
[4/7] incubator-tinkerpop git commit: Minor javadoc fix.
Posted by sp...@apache.org.
Minor javadoc fix.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/b007e833
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/b007e833
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/b007e833
Branch: refs/heads/master
Commit: b007e8333092fff4ab436a8d5b81d9e0fdc32357
Parents: fe0e665
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 27 08:37:15 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Nov 27 08:37:15 2015 -0500
----------------------------------------------------------------------
.../tinkerpop/gremlin/server/util/ServerGremlinExecutor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b007e833/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index a3a2175..fe3c9a5 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -66,7 +66,7 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
}
/**
- * Create a new object from {@link Settings} where thread pools are internally created. Note that if the
+ * Create a new object from {@link Settings} where thread pools are externally assigned. Note that if the
* {@code scheduleExecutorServiceClass} is set to {@code null} it will be created via
* {@link Executors#newScheduledThreadPool(int, ThreadFactory)}. If either of the {@link ExecutorService}
* instances are supplied, the {@link Settings#gremlinPool} value will be ignored for the pool size.
[7/7] incubator-tinkerpop git commit: Update changelog.
Posted by sp...@apache.org.
Update changelog.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/85c50c19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/85c50c19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/85c50c19
Branch: refs/heads/master
Commit: 85c50c1949763af9fcf873c0c95b011f9b00d02f
Parents: a98ee53
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 30 10:10:51 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 30 10:10:51 2015 -0500
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/85c50c19/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 2aca7dd..7473fb7 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Improved the ability to embed Gremlin Server by providing a way to get the `ServerGremlinExecutor` and improve reusability of `AbstractEvalOpProcessor` and related classes.
* `ProfileStep` is now available off of `Traversal` via `profile()`. To be consistent with `Traversal.explain()`.
* If no comparator is provided to `order()`, `Order.incr` is assumed (previously, an exception occurred).
* Fixed various Gremlin-Groovy tests that assumed `toString()`-able ids.
[6/7] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/TINKERPOP3-912'
Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/TINKERPOP3-912'
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/a98ee533
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/a98ee533
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/a98ee533
Branch: refs/heads/master
Commit: a98ee53356d28c7cea47e9caa088c8c8ef242636
Parents: 27d8253 d4cd1dd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Nov 30 10:08:53 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Nov 30 10:08:53 2015 -0500
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/driver/Client.java | 39 ++++++++++++++------
.../tinkerpop/gremlin/server/GremlinServer.java | 9 ++++-
.../server/op/AbstractEvalOpProcessor.java | 6 +--
.../server/op/standard/StandardOpProcessor.java | 35 ++++++++++++++----
.../server/util/ServerGremlinExecutor.java | 34 ++++++++++++++---
5 files changed, 94 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
[3/7] incubator-tinkerpop git commit: Correct grammar in exception
message.
Posted by sp...@apache.org.
Correct grammar in exception message.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/fe0e6654
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/fe0e6654
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/fe0e6654
Branch: refs/heads/master
Commit: fe0e6654a098419ade421bf686db52a74fd2a72b
Parents: 12e1250
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 26 11:17:59 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Nov 26 11:17:59 2015 -0500
----------------------------------------------------------------------
.../main/java/org/apache/tinkerpop/gremlin/driver/Client.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/fe0e6654/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
index d8a6eca..8c80b8a 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
@@ -511,7 +511,7 @@ public abstract class Client {
@Deprecated
@Override
public Client rebind(final String graphOrTraversalSourceName){
- throw new UnsupportedOperationException("Sessioned client do no support aliasing");
+ throw new UnsupportedOperationException("Sessioned client does not support aliasing");
}
/**
@@ -521,7 +521,7 @@ public abstract class Client {
*/
@Override
public Client alias(String graphOrTraversalSource) {
- throw new UnsupportedOperationException("Sessioned client do no support aliasing");
+ throw new UnsupportedOperationException("Sessioned client does not support aliasing");
}
/**
[2/7] incubator-tinkerpop git commit: Get rid of more internal
"rebound" naming.
Posted by sp...@apache.org.
Get rid of more internal "rebound" naming.
The naming of "rebound" was deprecated for 3.1.0 so this deprecation was due. Not a breaking changes as the new Alias client extends ReboundClient - should work as a compile timer replacement.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/12e1250a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/12e1250a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/12e1250a
Branch: refs/heads/master
Commit: 12e1250a55df841fbcd8aa37d1da998a17cd7fff
Parents: 5cb5911
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Nov 26 11:04:48 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Nov 26 11:04:48 2015 -0500
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/driver/Client.java | 35 +++++++++++++++-----
1 file changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/12e1250a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
index a2308f0..d8a6eca 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
@@ -310,7 +310,7 @@ public abstract class Client {
*/
@Override
public Client alias(String graphOrTraversalSource) {
- return new ReboundClusteredClient(this, graphOrTraversalSource);
+ return new AliasClusteredClient(this, graphOrTraversalSource);
}
/**
@@ -329,7 +329,7 @@ public abstract class Client {
* the created {@code Client}.
*/
public Client alias(final Map<String,String> aliases) {
- return new ReboundClusteredClient(this, aliases);
+ return new AliasClusteredClient(this, aliases);
}
/**
@@ -386,21 +386,38 @@ public abstract class Client {
* Uses a {@link org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient} that rebinds requests to a
* specified {@link Graph} or {@link TraversalSource} instances on the server-side.
*/
- public final static class ReboundClusteredClient extends Client {
+ public final static class AliasClusteredClient extends ReboundClusteredClient {
+ public AliasClusteredClient(ClusteredClient clusteredClient, String graphOrTraversalSource) {
+ super(clusteredClient, graphOrTraversalSource);
+ }
+
+ public AliasClusteredClient(ClusteredClient clusteredClient, Map<String, String> rebindings) {
+ super(clusteredClient, rebindings);
+ }
+ }
+
+ /**
+ * Uses a {@link org.apache.tinkerpop.gremlin.driver.Client.ClusteredClient} that rebinds requests to a
+ * specified {@link Graph} or {@link TraversalSource} instances on the server-side.
+ *
+ * @deprecated As of release 3.1.1-incubating, replaced by {@link AliasClusteredClient}.
+ */
+ @Deprecated
+ public static class ReboundClusteredClient extends Client {
private final ClusteredClient clusteredClient;
- private final Map<String,String> rebindings = new HashMap<>();
+ private final Map<String,String> aliases = new HashMap<>();
final CompletableFuture<Void> close = new CompletableFuture<>();
ReboundClusteredClient(final ClusteredClient clusteredClient, final String graphOrTraversalSource) {
super(clusteredClient.cluster);
this.clusteredClient = clusteredClient;
- rebindings.put("g", graphOrTraversalSource);
+ aliases.put("g", graphOrTraversalSource);
}
ReboundClusteredClient(final ClusteredClient clusteredClient, final Map<String,String> rebindings) {
super(clusteredClient.cluster);
this.clusteredClient = clusteredClient;
- this.rebindings.putAll(rebindings);
+ this.aliases.putAll(rebindings);
}
@Override
@@ -416,8 +433,8 @@ public abstract class Client {
@Override
public RequestMessage buildMessage(final RequestMessage.Builder builder) {
if (close.isDone()) throw new IllegalStateException("Client is closed");
- if (!rebindings.isEmpty())
- builder.addArg(Tokens.ARGS_ALIASES, rebindings);
+ if (!aliases.isEmpty())
+ builder.addArg(Tokens.ARGS_ALIASES, aliases);
return builder.create();
}
@@ -462,7 +479,7 @@ public abstract class Client {
@Override
public Client alias(String graphOrTraversalSource) {
if (close.isDone()) throw new IllegalStateException("Client is closed");
- return new ReboundClusteredClient(clusteredClient, graphOrTraversalSource);
+ return new AliasClusteredClient(clusteredClient, graphOrTraversalSource);
}
}