C# 클래스 Spring.Transaction.Support.TransactionSynchronizationManager

Internal class that manages resources and transaction synchronizations per thread.
Supports one resource per key without overwriting, i.e. a resource needs to be removed before a new one can be set for the same key. Supports a list of transaction synchronizations if synchronization is active.

Resource management code should check for thread-bound resources via GetResource(). It is normally not supposed to bind resources to threads, as this is the responsiblity of transaction managers. A further option is to lazily bind on first use if transaction synchronization is active, for performing transactions that span an arbitrary number of resources.

Transaction synchronization must be activated and deactivated by a transaction manager via InitSynchronization and ClearSynchronization. This is automatically supported by Spring.Transaction.Support.AbstractPlatformTransactionManager.

Resource management code should only register synchronizations when this manager is active, and perform resource cleanup immediately else. If transaction synchronization isn't active, there is either no current transaction, or the transaction manager doesn't support synchronizations.

Note that this class uses following naming convention for the named 'data slots' for storage of thread local data, 'Spring.Transaction:Name' where Name is either
파일 보기 프로젝트 열기: spring-projects/spring-net 1 사용 예제들

공개 메소드들

메소드 설명
BindResource ( Object key, Object value ) : void

Bind the given resource for teh given key to the current thread

Clear ( ) : void

Clears the entire transaction synchronization state for the current thread, registered synchronizations as well as the various transaction characteristics.

ClearSynchronization ( ) : void

Deactivate transaction synchronization for the current thread.

Called by transaction manager on transaction cleanup.

GetResource ( Object key ) : object

Retrieve a resource for the given key that is bound to the current thread.

HasResource ( Object key ) : bool

Check if there is a resource for the given key bound to the current thread.

InitSynchronization ( ) : void

Activate transaction synchronization for the current thread.

Called by transaction manager at the beginning of a transaction.

RegisterSynchronization ( ITransactionSynchronization synchronization ) : void

Register a new transaction synchronization for the current thread.

Typically called by resource management code.

UnbindResource ( Object key ) : object

Unbind a resource for the given key from the current thread

비공개 메소드들

메소드 설명
Describe ( object obj ) : string

메소드 상세

BindResource() 공개 정적인 메소드

Bind the given resource for teh given key to the current thread
public static BindResource ( Object key, Object value ) : void
key Object key to bind the value to
value Object value to bind
리턴 void

Clear() 공개 정적인 메소드

Clears the entire transaction synchronization state for the current thread, registered synchronizations as well as the various transaction characteristics.
public static Clear ( ) : void
리턴 void

ClearSynchronization() 공개 정적인 메소드

Deactivate transaction synchronization for the current thread.
Called by transaction manager on transaction cleanup.
/// If synchronization is not active. ///
public static ClearSynchronization ( ) : void
리턴 void

GetResource() 공개 정적인 메소드

Retrieve a resource for the given key that is bound to the current thread.
public static GetResource ( Object key ) : object
key Object key to check
리턴 object

HasResource() 공개 정적인 메소드

Check if there is a resource for the given key bound to the current thread.
public static HasResource ( Object key ) : bool
key Object key to check
리턴 bool

InitSynchronization() 공개 정적인 메소드

Activate transaction synchronization for the current thread.
Called by transaction manager at the beginning of a transaction.
/// If synchronization is already active. ///
public static InitSynchronization ( ) : void
리턴 void

RegisterSynchronization() 공개 정적인 메소드

Register a new transaction synchronization for the current thread.
Typically called by resource management code.
/// If synchronization is not active. ///
public static RegisterSynchronization ( ITransactionSynchronization synchronization ) : void
synchronization ITransactionSynchronization
리턴 void

UnbindResource() 공개 정적인 메소드

Unbind a resource for the given key from the current thread
if there is no value bound to the thread
public static UnbindResource ( Object key ) : object
key Object key to check
리턴 object