【问题标题】:Close Connection on SessionClient - AWS Neptune关闭 SessionClient 上的连接 - AWS Neptune
【发布时间】:2021-02-24 07:50:04
【问题描述】:

我使用 aws-neptune。 我尝试将我的查询实现为事务性的(使用 sessionClient,例如:https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-sessions.html)。但是当我尝试实现它时,关闭客户端会引发异常。我的情况也有类似的问题:https://groups.google.com/g/janusgraph-users/c/N1TPbUU7Szw

我的代码如下:

@Bean
public Cluster gremlinCluster()
{
    return Cluster.build()
            .addContactPoint(GREMLIN_ENDPOINT)
            .port(GREMLIN_PORT)
            .enableSsl(GREMLIN_SSL_ENABLED)
            .keyCertChainFile("classpath:SFSRootCAG2.pem")
            .create();
}

private void runInTransaction()
{
    String sessionId = UUID.randomUUID().toString();
    Client.SessionedClient client = cluster.connect(sessionId);

    try
    {
        client.submit("query...");
    }
    finally
    {
        if (client != null)
        {
            client.close();
        }
    }
}

例外是:

INFO (ConnectionPool.java:225) - Signalled closing of connection pool on Host{address=...} with core size of 1

WARN (Connection.java:322) - Timeout while trying to close connection on ... - force closing - server will close session on shutdown or expiration.

java.util.concurrent.TimeoutException

at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771)

有什么建议吗?

【问题讨论】:

    标签: gremlin tinkerpop3 amazon-neptune


    【解决方案1】:

    这可能是您在发送查询时无法观察到的服务器连接问题,因为您没有等待未来完成。

    当您执行client.submit("query..."); 时,您会收到一个未来。您需要等待该未来完成以观察任何异常(或成功)。

    我建议如下:

    1. 尝试使用 curl 使用 health status call 访问服务器以验证与服务器的连接。
    2. client.submit("query..."); 替换为client.submit("query...").all().join(); 以获取与服务器连接期间的错误。

    【讨论】:

      猜你喜欢
      • 2019-03-08
      • 2023-01-30
      • 1970-01-01
      • 2019-06-04
      • 1970-01-01
      • 2019-08-10
      • 2022-01-08
      • 2020-02-23
      • 2019-05-09
      相关资源
      最近更新 更多