|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.ResourceHolderSupport
public abstract class ResourceHolderSupport
Convenient base class for resource holders.
Features rollback-only support for nested transactions. Can expire after a certain number of seconds or milliseconds, to determine transactional timeouts.
DataSourceTransactionManager.doBegin(java.lang.Object, org.springframework.transaction.TransactionDefinition)
,
DataSourceUtils.applyTransactionTimeout(java.sql.Statement, javax.sql.DataSource)
Constructor Summary | |
---|---|
ResourceHolderSupport()
|
Method Summary | |
---|---|
void |
clear()
Clear the transactional state of this resource holder. |
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()
Return whether this object has an associated timeout. |
boolean |
isOpen()
Return whether there are still open references to this holder. |
boolean |
isRollbackOnly()
Return whether the resource transaction is marked as rollback-only. |
boolean |
isSynchronizedWithTransaction()
Return whether the resource is synchronized with a transaction. |
void |
released()
Decrease the reference count by one because the holder has been released (i.e. someone released the resource held by it). |
void |
requested()
Increase the reference count by one because the holder has been requested (i.e. someone requested the resource held by it). |
void |
reset()
Reset this resource holder - transactional state as well as reference count. |
void |
setRollbackOnly()
Mark the resource transaction as rollback-only. |
void |
setSynchronizedWithTransaction(boolean synchronizedWithTransaction)
Mark the resource as synchronized with a transaction. |
void |
setTimeoutInMillis(long millis)
Set the timeout for this object in milliseconds. |
void |
setTimeoutInSeconds(int seconds)
Set the timeout for this object in seconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceHolderSupport()
Method Detail |
---|
public void setSynchronizedWithTransaction(boolean synchronizedWithTransaction)
public boolean isSynchronizedWithTransaction()
public void setRollbackOnly()
public boolean isRollbackOnly()
public void setTimeoutInSeconds(int seconds)
seconds
- number of seconds until expirationpublic void setTimeoutInMillis(long millis)
millis
- number of milliseconds until expirationpublic boolean hasTimeout()
public 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()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |