public abstract class

ResourceHolderSupport

extends Object
implements ResourceHolder
java.lang.Object
   ↳ org.springframework.transaction.support.ResourceHolderSupport
Known Direct Subclasses

Class Overview

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.

Summary

Public Constructors
ResourceHolderSupport()
Public Methods
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.
boolean isVoid()
Determine whether this holder is considere 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 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.
void unbound()
Notify this holder that it has been unbound from transaction synchronization.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.transaction.support.ResourceHolder

Public Constructors

public ResourceHolderSupport ()

Public Methods

public void clear ()

Clear the transactional state of this resource holder.

public Date getDeadline ()

Return the expiration deadline of this object.

Returns
  • the deadline as Date object

public long getTimeToLiveInMillis ()

Return the time to live for this object in milliseconds.

Returns
  • number of millseconds until expiration
Throws
TransactionTimedOutException if the deadline has already been reached

public int getTimeToLiveInSeconds ()

Return the time to live for this object in seconds. Rounds up eagerly, e.g. 9.00001 still to 10.

Returns
  • number of seconds until expiration
Throws
TransactionTimedOutException if the deadline has already been reached

public boolean hasTimeout ()

Return whether this object has an associated timeout.

public boolean isOpen ()

Return whether there are still open references to this holder.

public boolean isRollbackOnly ()

Return whether the resource transaction is marked as rollback-only.

public boolean isSynchronizedWithTransaction ()

Return whether the resource is synchronized with a transaction.

public boolean isVoid ()

Determine whether this holder is considere as 'void', i.e. as a leftover from a previous thread.

public void released ()

Decrease the reference count by one because the holder has been released (i.e. someone released the resource held by it).

public void requested ()

Increase the reference count by one because the holder has been requested (i.e. someone requested the resource held by it).

public void reset ()

Reset this resource holder - transactional state as well as reference count.

public void setRollbackOnly ()

Mark the resource transaction as rollback-only.

public void setSynchronizedWithTransaction (boolean synchronizedWithTransaction)

Mark the resource as synchronized with a transaction.

public void setTimeoutInMillis (long millis)

Set the timeout for this object in milliseconds.

Parameters
millis number of milliseconds until expiration

public void setTimeoutInSeconds (int seconds)

Set the timeout for this object in seconds.

Parameters
seconds number of seconds until expiration

public void unbound ()

Notify this holder that it has been unbound from transaction synchronization.