public class ThreadTxn extends Object
ThreadAction.run()
is
called. A thread is created and the transaction started during a call to the
creation operations threadTxnRead(org.apache.jena.sparql.core.Transactional, java.lang.Runnable)
or threadTxnWrite(org.apache.jena.sparql.core.Transactional, java.lang.Runnable)
.
The associated Runnable is called and the transaction completed when
ThreadAction.run()
is called. Being on a thread, the state of the world the
forked transaction sees is outside the creating thread which may itself be in a
transaction. Warning: creating a write transaction inside a write transaction
will cause deadlock.Constructor and Description |
---|
ThreadTxn() |
Modifier and Type | Method and Description |
---|---|
static ThreadAction |
threadTxnRead(Transactional trans,
Runnable action)
Create a thread-backed delayed READ transaction action.
|
static ThreadAction |
threadTxnWrite(Transactional trans,
Runnable action)
Create a thread-backed delayed WRITE action.
|
static ThreadAction |
threadTxnWriteAbort(Transactional trans,
Runnable action)
Create a thread-backed delayed WRITE-abort action (mainly for testing).
|
public static ThreadAction threadTxnRead(Transactional trans, Runnable action)
ThreadAction.run()
to perform the read transaction.public static ThreadAction threadTxnWrite(Transactional trans, Runnable action)
ThreadAction.run()
to perform the write transaction.
(If called from inside a write transaction on the trans
,
this will deadlock.)public static ThreadAction threadTxnWriteAbort(Transactional trans, Runnable action)
Licenced under the Apache License, Version 2.0