From 3380a7864bf6de64471bd246ade6272e34b969be Mon Sep 17 00:00:00 2001 From: lvca Date: Fri, 8 Dec 2023 22:20:43 +0000 Subject: [PATCH] deploy: 00e9f773dfc3c65d4022b260dcb4ebcd63be79e1 --- docs/index.html | 26 +++++++++++++++++++++++++- src/main/asciidoc/api/gremlin.adoc | 12 ++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 245913eb..ebf69796 100644 --- a/docs/index.html +++ b/docs/index.html @@ -9924,6 +9924,30 @@

Gremlin from Java API

} +
+

Since a RemoteDatabase instance cannot be shared between threads, if your application is multi-threads, you can use the ArcadeGraphFactory to acquire ArcadeGraph instances from a pool. Example:

+
+
+
+
try (ArcadeGraphFactory pool = new ArcadeGraphFactory("127.0.0.1", 2480, "mydb", "root", "playwithdata")) {
+  try( ArcadeGraph graph = pool.get() ){
+    // DO SOMETHING WITH ARCADE GRAPH
+  }
+}
+
+
+
+ + + + + +
+
Note
+
+Remember to call ArcadeGraph.close() to release the ArcadeGraph instance back into the pool. ArcadeGraph implements Closable, so you can just use it in a try block like in the example above. +
+

Gremlin through Postgres Driver

You can execute a Gremlin query against ArcadeDB server by using the Postgres driver and prefixing the query with {gremlin}. @@ -24543,7 +24567,7 @@

11.11. Report an Issue

diff --git a/src/main/asciidoc/api/gremlin.adoc b/src/main/asciidoc/api/gremlin.adoc index c61a1366..b4f80f89 100644 --- a/src/main/asciidoc/api/gremlin.adoc +++ b/src/main/asciidoc/api/gremlin.adoc @@ -48,6 +48,18 @@ try( RemoteDatabase database = new RemoteDatabase("127.0.0.1", 2480, "graph", "r } ``` +Since a `RemoteDatabase` instance cannot be shared between threads, if your application is multi-threads, you can use the `ArcadeGraphFactory` to acquire `ArcadeGraph` instances from a pool. Example: + +```java +try (ArcadeGraphFactory pool = new ArcadeGraphFactory("127.0.0.1", 2480, "mydb", "root", "playwithdata")) { + try( ArcadeGraph graph = pool.get() ){ + // DO SOMETHING WITH ARCADE GRAPH + } +} +``` + +NOTE: Remember to call `ArcadeGraph.close()` to release the `ArcadeGraph` instance back into the pool. `ArcadeGraph` implements `Closable`, so you can just use it in a `try` block like in the example above. + [discrete] ==== Gremlin through Postgres Driver