public abstract class ResourceHolderSupport extends java.lang.Object implements ResourceHolder
Features rollback-only support for participating transactions. Can expire after a certain number of seconds or milliseconds in order to determine a transactional timeout.
Constructor and Description |
---|
ResourceHolderSupport() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the transactional state of this resource holder.
|
java.util.Date |
getDeadline()
Return the expiration deadline of this object.
|
long |
getTimeToLiveInMillis()
Return the time to live for this object in milliseconds.
|
int |
getTimeToLiveInSeconds()
Return the time to live for this object in seconds.
|
boolean |
hasTimeout() |
boolean |
isOpen() |
boolean |
isRollbackOnly() |
boolean |
isSynchronizedWithTransaction() |
boolean |
isVoid()
Determine whether this holder is considered as 'void',
i.e.
|
void |
released()
Decrease the reference count by one because the holder has been released
(i.e.
|
void |
requested()
Increase the reference count by one because the holder has been requested
(i.e.
|
void |
reset()
Reset this resource holder - transactional state as well as reference count.
|
void |
resetRollbackOnly()
Reset the rollback-only status for this resource transaction.
|
void |
setRollbackOnly()
Mark the resource transaction as rollback-only.
|
void |
setSynchronizedWithTransaction(boolean synchronizedWithTransaction)
Mark the resource as synchronized with a transaction.
|
void |
setTimeout(java.time.Duration timeout)
Set the timeout for this object in seconds.
|
void |
setTimeoutInMillis(long millis)
Set the timeout for this object in milliseconds.
|
void |
unbound()
Notify this holder that it has been unbound from transaction synchronization.
|
public void setSynchronizedWithTransaction(boolean synchronizedWithTransaction)
synchronizedWithTransaction
- True if synchronized with transactionpublic boolean isSynchronizedWithTransaction()
public void setRollbackOnly()
public void resetRollbackOnly()
Only really intended to be called after custom rollback steps which keep the original resource in action, e.g. in case of a savepoint.
SavepointManager.rollbackToSavepoint(java.lang.Object)
public boolean isRollbackOnly()
public void setTimeout(java.time.Duration timeout)
timeout
- The timeoutpublic void setTimeoutInMillis(long millis)
millis
- number of milliseconds until expirationpublic boolean hasTimeout()
@Nullable public java.util.Date getDeadline()
public int getTimeToLiveInSeconds()
TransactionTimedOutException
- if the deadline has already been reachedpublic long getTimeToLiveInMillis() throws TransactionTimedOutException
TransactionTimedOutException
- if the deadline has already been reachedpublic void requested()
public void released()
public boolean isOpen()
public void clear()
public void reset()
reset
in interface ResourceHolder
public void unbound()
ResourceHolder
unbound
in interface ResourceHolder
public boolean isVoid()
ResourceHolder
isVoid
in interface ResourceHolder