Class Client.SessionedClient
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.driver.Client
-
- org.apache.tinkerpop.gremlin.driver.Client.SessionedClient
-
- Enclosing class:
- Client
public static final class Client.SessionedClient extends Client
AClientimplementation that operates in the context of a session. Requests are sent to a single server, where each request is bound to the same thread with the same set of bindings across requests. Transaction are not automatically committed. It is up the client to issue commit/rollback commands.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.tinkerpop.gremlin.driver.Client
Client.AliasClusteredClient, Client.ClusteredClient, Client.SessionedClient, Client.SessionSettings, Client.Settings
-
-
Field Summary
-
Fields inherited from class org.apache.tinkerpop.gremlin.driver.Client
cluster, initialized, settings, TOO_MANY_IN_FLIGHT_REQUESTS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.tinkerpop.gremlin.util.message.RequestMessage.BuilderbuildMessage(org.apache.tinkerpop.gremlin.util.message.RequestMessage.Builder builder)Adds theTokens.ARGS_SESSIONvalue to everyRequestMessage.protected org.apache.tinkerpop.gremlin.driver.ConnectionchooseConnection(org.apache.tinkerpop.gremlin.util.message.RequestMessage msg)Since the session is bound to a single host, simply borrow a connection from that pool.CompletableFuture<Void>closeAsync()Close the boundConnectionPool.StringgetSessionId()Returns the session identifier bound to thisClient.protected voidinitializeImplementation()Randomly choose an availableHostto bind the session too and initialize theConnectionPool.booleanisClosing()-
Methods inherited from class org.apache.tinkerpop.gremlin.driver.Client
alias, alias, close, getCluster, getSettings, init, makeDefaultAliasMap, submit, submit, submit, submit, submit, submit, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync, submitAsync
-
-
-
-
Method Detail
-
getSessionId
public String getSessionId()
Returns the session identifier bound to thisClient.
-
buildMessage
public org.apache.tinkerpop.gremlin.util.message.RequestMessage.Builder buildMessage(org.apache.tinkerpop.gremlin.util.message.RequestMessage.Builder builder)
Adds theTokens.ARGS_SESSIONvalue to everyRequestMessage.- Overrides:
buildMessagein classClient
-
chooseConnection
protected org.apache.tinkerpop.gremlin.driver.Connection chooseConnection(org.apache.tinkerpop.gremlin.util.message.RequestMessage msg) throws TimeoutException, org.apache.tinkerpop.gremlin.driver.exception.ConnectionExceptionSince the session is bound to a single host, simply borrow a connection from that pool.- Specified by:
chooseConnectionin classClient- Throws:
TimeoutExceptionorg.apache.tinkerpop.gremlin.driver.exception.ConnectionException
-
initializeImplementation
protected void initializeImplementation()
Randomly choose an availableHostto bind the session too and initialize theConnectionPool.- Specified by:
initializeImplementationin classClient
-
closeAsync
public CompletableFuture<Void> closeAsync()
Close the boundConnectionPool.- Specified by:
closeAsyncin classClient
-
-