public class LocalRepoTransactionImpl extends Object implements LocalRepoTransaction, ContextWithLocalRepoManager, ContextWithPersistenceManager
| Modifier and Type | Field and Description |
|---|---|
static long |
LOCK_TIMEOUT |
| Constructor and Description |
|---|
LocalRepoTransactionImpl(co.codewizards.cloudstore.local.LocalRepoManagerImpl localRepoManager,
boolean write) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_rollback() |
void |
addPostCloseListener(LocalRepoTransactionPostCloseListener listener) |
void |
addPreCloseListener(LocalRepoTransactionPreCloseListener listener) |
void |
close()
Equivalent to
LocalRepoTransaction.rollbackIfActive(). |
void |
commit() |
protected void |
firePostCloseListeners(boolean commit) |
protected void |
firePreCloseListeners(boolean commit) |
void |
flush() |
<T> T |
getContextObject(Class<T> clazz) |
<D> D |
getDao(Class<D> daoClass) |
LocalRepoManager |
getLocalRepoManager() |
long |
getLocalRevision() |
PersistenceManager |
getPersistenceManager() |
boolean |
isActive() |
void |
removeContextObject(Class<?> clazz) |
void |
removeContextObject(Object object) |
void |
rollback() |
void |
rollbackIfActive() |
void |
setContextObject(Object object) |
public static final long LOCK_TIMEOUT
public LocalRepoTransactionImpl(co.codewizards.cloudstore.local.LocalRepoManagerImpl localRepoManager, boolean write)
public void commit()
commit in interface LocalRepoTransactionpublic boolean isActive()
isActive in interface LocalRepoTransactionpublic void rollback()
rollback in interface LocalRepoTransactionpublic void rollbackIfActive()
rollbackIfActive in interface LocalRepoTransactionprotected void _rollback()
public void close()
LocalRepoTransactionLocalRepoTransaction.rollbackIfActive().
Implementations must make sure that invoking close() means exactly the same as invoking
rollbackIfActive(). This method was added to make the usage of LocalRepoTransaction
possible in a try-with-resources-clause. See AutoCloseable for more details. Here's a code
example:
try ( LocalRepoTransaction transaction = localRepoManager.beginWriteTransaction(); ) {
// Write sth. into the database...
// And don't forget to commit!
transaction.commit();
}
close in interface LocalRepoTransactionclose in interface AutoCloseableLocalRepoTransaction.rollbackIfActive()public PersistenceManager getPersistenceManager()
getPersistenceManager in interface ContextWithPersistenceManagerpublic long getLocalRevision()
getLocalRevision in interface LocalRepoTransactionpublic LocalRepoManager getLocalRepoManager()
getLocalRepoManager in interface ContextWithLocalRepoManagergetLocalRepoManager in interface LocalRepoTransactionpublic <D> D getDao(Class<D> daoClass)
getDao in interface DaoProviderpublic void flush()
flush in interface LocalRepoTransactionpublic void setContextObject(Object object)
setContextObject in interface ExtensibleContextpublic <T> T getContextObject(Class<T> clazz)
getContextObject in interface ExtensibleContextpublic void removeContextObject(Object object)
removeContextObject in interface ExtensibleContextpublic void removeContextObject(Class<?> clazz)
removeContextObject in interface ExtensibleContextpublic void addPreCloseListener(LocalRepoTransactionPreCloseListener listener)
addPreCloseListener in interface LocalRepoTransactionpublic void addPostCloseListener(LocalRepoTransactionPostCloseListener listener)
addPostCloseListener in interface LocalRepoTransactionprotected void firePreCloseListeners(boolean commit)
protected void firePostCloseListeners(boolean commit)
Copyright © 2013–2019. All rights reserved.