Package com.Lomikel.Januser
Class GremlinClient
java.lang.Object
com.Lomikel.Januser.GremlinClient
- Direct Known Subclasses:
DirectGremlinClient,StringGremlinClient
Shared remote Gremlin connection and cleanup lifecycle.
Subclasses select a serializer and either expose a typed remote traversal source or script-submission results.
- Author:
- J.Hrivnac
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionGremlinClient(String hostname, int port) Create with connection parameters.protectedGremlinClient(String hostname, int port, boolean deferInitialization) Create with optional deferred initialization for subclasses that need their own state initialized beforeopen(java.lang.String, int)andconnect(). -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Close client.cluster()Give theCluster.protected static RuntimeExceptioncollectCleanupFailure(RuntimeException failure, String resource, Exception cause) Accumulate cleanup failures without preventing later resources from closing.abstract voidconnect()Connect client.voidcreateCluster(String hostname, int port, MessageSerializer serializer) CreateCluster.protected final voidinitialize(String hostname, int port) Open and connect, closing partial resources if initialization fails.abstract voidOpen.
-
Field Details
-
_cluster
-
log
Logging .
-
-
Constructor Details
-
GremlinClient
Create with connection parameters.- Parameters:
hostname- The Gremlin hostname.port- The Gremlin port.
-
GremlinClient
Create with optional deferred initialization for subclasses that need their own state initialized beforeopen(java.lang.String, int)andconnect().- Parameters:
hostname- The Gremlin hostname.port- The Gremlin port.deferInitialization- Whether the subclass will callinitialize(java.lang.String, int)explicitly.
-
-
Method Details
-
initialize
Open and connect, closing partial resources if initialization fails.- Parameters:
hostname- The Gremlin hostname.port- The Gremlin port.
-
collectCleanupFailure
protected static RuntimeException collectCleanupFailure(RuntimeException failure, String resource, Exception cause) Accumulate cleanup failures without preventing later resources from closing.- Parameters:
failure- The previously collected failure, ornull.resource- The resource whose close failed.cause- The close failure.- Returns:
- The first failure with later failures suppressed.
-
open
Open.- Parameters:
hostname- The Gremlin hostname.port- The Gremlin port.
-
connect
Connect client. -
close
Close client. -
createCluster
CreateCluster.- Parameters:
hostname- The Gremlin hostname.port- The Gremlin port.serializer- The usedMessageSerializer.
-
cluster
Give theCluster.- Returns:
- The attached
Cluster.
-