Код ниже возвращает обход Гремлина из входных данных
Код: Выделить всё
GraphTraversalSource withRemote = null;
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("aws-host-engine");
builder.port(8182);
builder.enableSsl(true);
builder.connectionSetupTimeoutMillis(200000);
builder.maxInProcessPerConnection(20);
builder.maxConnectionPoolSize(20);
builder.keepAliveInterval(0);
if (Objects.nonNull(accessKeyId)) {
// if IAM Authentication is enabled while cluster setup
logDebug("IAM Authentication is enabled");
builder.handshakeInterceptor(r -> {
try {
AwsBasicCredentials basicAWSCredentials = AwsBasicCredentials.create("accessKeyId",
"secretAccessKey");
StaticCredentialsProvider awsStaticCredentialsProvider = StaticCredentialsProvider
.create(basicAWSCredentials);
NeptuneNettyHttpSigV4Signer sigV4Signer = new NeptuneNettyHttpSigV4Signer(region,
awsStaticCredentialsProvider);
sigV4Signer.signRequest(r);
} catch (NeptuneSigV4SignerException e) {
throw new RuntimeException("Exception occurred while signing the request", e);
}
return r;
});
}
cluster = builder.create();
withRemote = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(cluster));
Код: Выделить всё
Transaction tx = beginTx(traversal);
for (int i = 0; i < insertCount; i++) {
Map attrNameToValues = getPropertyTypeWiseValues(tableName, i);
GraphTraversal vertex = traversal.addV(vertexName);
for (Entry entry : attrNameToValues.entrySet()) {
vertex.property(Cardinality.single, entry.getKey(), entry.getValue());
}
vertex.iterate();
}
tx.commit();
tx.close();
Код: Выделить всё
ERROR org.apache.tinkerpop.gremlin.driver.Client - Could not initialize client for Host{address=aws-host-engine/ip:8182, hostUri=wss://aws-host-engine:8182/gremlin}
06:21:46 2026-04-22 06:21:41,142 696378 [main] [] [] ERROR org.apache.tinkerpop.gremlin.driver.Client - Initialization failed
06:21:46 java.util.concurrent.CompletionException: Could not initialize 2 (minPoolSize) connections in pool. Successful connections=0. Closing the connection pool.
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionPool.(ConnectionPool.java:164)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionPool.(ConnectionPool.java:103)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionPool.(ConnectionPool.java:98)
06:21:46 at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$new$5(Client.java:584)
06:21:46 at org.apache.tinkerpop.gremlin.driver.Client$ClusteredClient.lambda$initializeImplementation$0(Client.java:534)
06:21:46 at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
06:21:46 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
06:21:46 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
06:21:46 at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
06:21:46 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
06:21:46 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
06:21:46 at java.base/java.lang.Thread.run(Thread.java:829)
06:21:46 Caused by: org.apache.tinkerpop.gremlin.driver.exception.ConnectionException: Could not open Connection{channel=null host=Host{address=aws-host-engine/ip:8182, hostUri=wss://aws-host-engine:8182/gremlin} isDead=false borrowed=0 pending=0 markedReplaced=false closing=false created=2026-04-22T00:51:11.105874Z thread=gremlin-driver-conn-scheduler-1}
06:21:46 at org.apache.tinkerpop.gremlin.driver.Connection.(Connection.java:142)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionFactory.create(ConnectionFactory.java:34)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionPool.lambda$new$0(ConnectionPool.java:130)
06:21:46 ... 7 more
06:21:46 Caused by: io.netty.channel.ConnectTimeoutException: connection timed out after 30000 ms: aws-host-engine/ip:8182
06:21:46 at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:263)
06:21:46 at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
06:21:46 at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:160)
06:21:46 at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
06:21:46 at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
06:21:46 at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
06:21:46 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
06:21:46 at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
06:21:46 at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
06:21:46 ... 1 more
06:21:46 Suppressed: java.lang.RuntimeException: Rethrowing promise failure cause
06:21:46 at io.netty.util.concurrent.DefaultPromise.rethrowIfFailed(DefaultPromise.java:686)
06:21:46 at io.netty.util.concurrent.DefaultPromise.sync(DefaultPromise.java:420)
06:21:46 at io.netty.channel.DefaultChannelPromise.sync(DefaultChannelPromise.java:119)
06:21:46 at io.netty.channel.DefaultChannelPromise.sync(DefaultChannelPromise.java:30)
06:21:46 at org.apache.tinkerpop.gremlin.driver.Connection.(Connection.java:118)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionFactory.create(ConnectionFactory.java:34)
06:21:46 at org.apache.tinkerpop.gremlin.driver.ConnectionPool.lambda$new$0(ConnectionPool.java:130)
Мобильная версия