What are the advantages of using CreateThreadedTx in Multithreading if we can explicitly share the transaction object?

16 views
Skip to first unread message

Suriya.Rajasekar

unread,
May 11, 2020, 7:49:14 PM5/11/20
to JanusGraph users
Hi,

If we can share the transaction object among multiple threads such that they work concurrently in the same transaction and are able to see each other's operation. Then what are the advantages of  using CreateThreadedTx()  in multithreading ?How is it different from just sharing the transaction object among threads ?


Thanks
Suriya



Stephen Mallette

unread,
May 12, 2020, 9:23:36 AM5/12/20
to janusgra...@googlegroups.com
I'm not sure that I follow your question because I'm not sure what "transaction object" you're sharing among threads to be able to see each other's operations. That is precisely the object that graph.tx().createThreadedTx() establishes. If you don't use that object then different threads will establish transactions within a separate ThreadLocal and they won't see each others changes.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/a0137cb7-63e4-4cb4-ad17-7031541c2bcb%40googlegroups.com.

Suriya.Rajasekar

unread,
May 12, 2020, 12:58:00 PM5/12/20
to JanusGraph users
Hi Stephen,

Thank you for your response.  I would like to know the difference between graph.newTransaction() and graph.tx().createThreadedTx() in a multithreaded environment.


On Tuesday, May 12, 2020 at 6:23:36 AM UTC-7, Stephen Mallette wrote:
I'm not sure that I follow your question because I'm not sure what "transaction object" you're sharing among threads to be able to see each other's operations. That is precisely the object that graph.tx().createThreadedTx() establishes. If you don't use that object then different threads will establish transactions within a separate ThreadLocal and they won't see each others changes.

On Mon, May 11, 2020 at 7:49 PM Suriya.Rajasekar <suriya.ja...@gmail.com> wrote:
Hi,

If we can share the transaction object among multiple threads such that they work concurrently in the same transaction and are able to see each other's operation. Then what are the advantages of  using CreateThreadedTx()  in multithreading ?How is it different from just sharing the transaction object among threads ?


Thanks
Suriya



--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@googlegroups.com.

Stephen Mallette

unread,
May 12, 2020, 1:13:35 PM5/12/20
to janusgra...@googlegroups.com
Hmm - someone might correct me, but I don't think that there is a difference:


I think you would want to prefer the TinkerPop method call though of graph.tx().createThreadedTx() rather than the underlying JanusGraph one though. 

To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/e99be68a-ce06-4cc8-ae46-af8cc4ea6f22%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages