@Component public class TransactionServiceImpl extends AbstractService implements TransactionService
Transaction
service which is able to
create/commit/rollback Transaction
objects A Scheduled
annotation is used for removing timed out TransactionsModifier and Type | Field and Description |
---|---|
static long |
REAP_INTERVAL |
jcrTools
Constructor and Description |
---|
TransactionServiceImpl() |
Modifier and Type | Method and Description |
---|---|
Transaction |
beginTransaction(javax.jcr.Session sess,
String userName)
Create a new Transaction and add it to the currently open ones
|
Transaction |
commit(String txid)
Commit a
Transaction with the given id |
boolean |
exists(String txid)
Check if a Transaction exists
|
static String |
getCurrentTransactionId(javax.jcr.Session session)
Get the current Transaction ID for a session
|
Transaction |
getTransaction(javax.jcr.Session session)
Get the current Transaction for a session
|
Transaction |
getTransaction(String txId,
String userName)
Receive an open
Transaction for a given user |
static boolean |
isInTransaction(javax.jcr.Session session)
Check if a session is possibly within a transaction
|
void |
removeAndRollbackExpired()
Every REAP_INTERVAL milliseconds, check for expired transactions.
|
Transaction |
rollback(String txid)
Roll a
Transaction back |
exists, findNode, findOrCreateNode, tagHierarchyWithPairtreeMixin
public static final long REAP_INTERVAL
public TransactionServiceImpl()
public static boolean isInTransaction(javax.jcr.Session session)
session
- the session@Scheduled(fixedRate=1000L) public void removeAndRollbackExpired()
removeAndRollbackExpired
in interface TransactionService
public Transaction beginTransaction(javax.jcr.Session sess, String userName)
beginTransaction
in interface TransactionService
sess
- The session to use for this TransactionuserName
- the user nameTransaction
public Transaction getTransaction(String txId, String userName)
TransactionService
Transaction
for a given usergetTransaction
in interface TransactionService
txId
- the Id of the Transaction
userName
- the name of the Principal
Transaction
with this userpublic Transaction getTransaction(javax.jcr.Session session)
getTransaction
in interface TransactionService
session
- the sessionSessionMissingException
- if transaction missing exception occurredpublic static String getCurrentTransactionId(javax.jcr.Session session)
session
- the sessionpublic boolean exists(String txid)
exists
in interface TransactionService
txid
- the Id of the Transaction
Transaction
public Transaction commit(String txid)
Transaction
with the given idcommit
in interface TransactionService
txid
- the id of the Transaction
public Transaction rollback(String txid)
Transaction
backrollback
in interface TransactionService
txid
- the id of the Transaction
Transaction
objectCopyright © 2013–2016 DuraSpace, Inc.. All rights reserved.