Class TxnSerializable
java.lang.Object
org.aksw.commons.txn.impl.TxnReadUncommitted
org.aksw.commons.txn.impl.TxnSerializable
- All Implemented Interfaces:
Txn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Pathprotected Stringprotected Pathprotected Stringprotected LockFromFileprotected Pathprotected Stringprotected Durationprotected Pathprotected Stringprotected Pathprotected Stringprotected Pathprotected Stringprotected TxnMgrImplFields inherited from class TxnReadUncommitted
containerCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidbooleanclaim()Instruct this TxnMgr to try to claim (i.e.voidDeclare that the resource was accessed by the transaction Upon recovery the resource's state must be checked for whether any actions need to be taken.protected TxnResourceApicreateResourceApi(Path<String> key) getId()Get the id of this transactiongetOwner()getRelPathForJournalEntry(Path txnPath) getResourceApi(String resourceName) getResourceApi(Path<String> resRelPath) Get access to a resource as seen from this txnbooleanisCommit()booleanbooleanbooleanisStale()A stale transaction was idle for longer than the heartbeat time.booleanisWrite()protected <T> TrunWithMgmtLock(Callable<T> action) protected <T> TrunWithVerifiedOwner(Callable<T> action) Acquires the txn's management lock, validates ownership and runs an action while the lock is held.voidsetActivityDate(Instant instant) Update the transaction's most recent activity timestamp to given timestamp; Used to prevent other processes from considering the transaction stale.Stream the resources to which access has been declared The returned stream must be closed!voidprotected voidvoidMethods inherited from class TxnReadUncommitted
getTxnMgr, listVisibleFiles, promoteMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Txn
updateActivityDate
-
Field Details
-
mgmtLockTtl
-
txnMgr
-
txnId
-
txnFolder
-
commitFilename
-
finalizeFilename
-
rollbackFilename
-
commitFile
-
finalizeFile
-
rollbackFile
-
ownerFilename
-
ownerFile
-
mgmtLockFilename
-
mgmtLockFile
-
mgmtLock
-
-
Constructor Details
-
TxnSerializable
-
-
Method Details
-
getId
-
createResourceApi
- Overrides:
createResourceApiin classTxnReadUncommitted
-
getCreationDate
- Specified by:
getCreationDatein interfaceTxn- Overrides:
getCreationDatein classTxnReadUncommitted
-
getResourceApi
-
getResourceApi
Description copied from interface:TxnGet access to a resource as seen from this txn- Specified by:
getResourceApiin interfaceTxn- Overrides:
getResourceApiin classTxnReadUncommitted
-
isWrite
public boolean isWrite()- Specified by:
isWritein interfaceTxn- Overrides:
isWritein classTxnReadUncommitted
-
cleanUpTxn
Declare that the resource was accessed by the transaction Upon recovery the resource's state must be checked for whether any actions need to be taken. Note, that declaration of access to a resource does not lock it- Specified by:
cleanUpTxnin interfaceTxn- Overrides:
cleanUpTxnin classTxnReadUncommitted- Parameters:
resourceName-- Throws:
IOException
-
addCommit
- Specified by:
addCommitin interfaceTxn- Overrides:
addCommitin classTxnReadUncommitted- Throws:
IOException
-
addFinalize
- Specified by:
addFinalizein interfaceTxn- Overrides:
addFinalizein classTxnReadUncommitted- Throws:
IOException
-
addRollback
- Specified by:
addRollbackin interfaceTxn- Overrides:
addRollbackin classTxnReadUncommitted- Throws:
IOException
-
isFinalize
- Specified by:
isFinalizein interfaceTxn- Overrides:
isFinalizein classTxnReadUncommitted- Throws:
IOException
-
isCommit
- Specified by:
isCommitin interfaceTxn- Overrides:
isCommitin classTxnReadUncommitted- Throws:
IOException
-
isRollback
- Specified by:
isRollbackin interfaceTxn- Overrides:
isRollbackin classTxnReadUncommitted- Throws:
IOException
-
streamAccessedEntries
Stream the resources to which access has been declared The returned stream must be closed!- Throws:
IOException
-
getRelPathForJournalEntry
-
streamAccessedResourcePaths
- Specified by:
streamAccessedResourcePathsin interfaceTxn- Overrides:
streamAccessedResourcePathsin classTxnReadUncommitted- Throws:
IOException
-
getActivityDate
- Specified by:
getActivityDatein interfaceTxn- Overrides:
getActivityDatein classTxnReadUncommitted- Throws:
IOException
-
setActivityDate
Description copied from interface:TxnUpdate the transaction's most recent activity timestamp to given timestamp; Used to prevent other processes from considering the transaction stale.- Specified by:
setActivityDatein interfaceTxn- Overrides:
setActivityDatein classTxnReadUncommitted- Throws:
IOException
-
isStale
A stale transaction was idle for longer than the heartbeat time. If the owner file (used for heartbeat checks) does not (yet) exist then the txn is also considered stale.- Specified by:
isStalein interfaceTxn- Overrides:
isStalein classTxnReadUncommitted- Throws:
IOException
-
getOwner
- Throws:
IOException
-
writeOwner
- Throws:
IOException
-
claim
public boolean claim()Description copied from interface:TxnInstruct this TxnMgr to try to claim (i.e. take ownership) of this txn. Should only be used on stale transactions. A claim fails - indicated by a return value of false - if the txn's heartbeat timeout has not been reached. This condition also occurs if another thread won the competition for claiming a txn.- Specified by:
claimin interfaceTxn- Overrides:
claimin classTxnReadUncommitted
-
updateHeartbeatInternal
- Throws:
IOException
-
updateHeartbeat
- Specified by:
updateHeartbeatin interfaceTxn- Overrides:
updateHeartbeatin classTxnReadUncommitted- Throws:
IOException
-
getMostRecentHeartbeat
- Specified by:
getMostRecentHeartbeatin interfaceTxn- Overrides:
getMostRecentHeartbeatin classTxnReadUncommitted- Throws:
IOException
-
getDurationToNextHeartbeat
- Specified by:
getDurationToNextHeartbeatin interfaceTxn- Overrides:
getDurationToNextHeartbeatin classTxnReadUncommitted- Throws:
IOException
-
runWithMgmtLock
-
runWithVerifiedOwner
Acquires the txn's management lock, validates ownership and runs an action while the lock is held.- Type Parameters:
T-- Parameters:
action-- Returns:
-