@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 Transactions| Modifier 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)
Recieve 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, findOrCreateNodepublic static final long REAP_INTERVAL
public TransactionServiceImpl()
public static boolean isInTransaction(javax.jcr.Session session)
session - @Scheduled(fixedRate=1000L) public void removeAndRollbackExpired()
removeAndRollbackExpired in interface TransactionServicepublic Transaction beginTransaction(javax.jcr.Session sess, String userName)
beginTransaction in interface TransactionServicesess - The session to use for this TransactionTransactionpublic Transaction getTransaction(String txId, String userName) throws TransactionMissingException
TransactionServiceTransaction for a given usergetTransaction in interface TransactionServicetxId - the Id of the TransactionuserName - the name of the PrincipalTransactionTransactionMissingException - if the transaction could not be found or is not associated
with this userpublic Transaction getTransaction(javax.jcr.Session session) throws TransactionMissingException
getTransaction in interface TransactionServicesession - TransactionMissingExceptionpublic static String getCurrentTransactionId(javax.jcr.Session session)
session - public boolean exists(String txid)
exists in interface TransactionServicetxid - the Id of the TransactionTransactionpublic Transaction commit(String txid)
Transaction with the given idcommit in interface TransactionServicetxid - the id of the Transactionpublic Transaction rollback(String txid)
Transaction backrollback in interface TransactionServicetxid - the id of the TransactionTransaction objectCopyright © 2013-2014 DuraSpace, Inc.. All Rights Reserved.