net.sf.xbus.base.core
Class TAManager

java.lang.Object
  extended by net.sf.xbus.base.core.TAManager

public class TAManager
extends java.lang.Object

TAManager manages transactions.

It implements the Singleton Design-Patterns: An instance of TAManager is created for every thread. This instance can be fetched with getInstance().


Method Summary
 void begin()
          Initializes a transaction.
static void clear()
           
 void clearManager()
           
 void close()
          Closes all registered resources.
 void commit()
          Commits all actions on the registered resources and closes the resources.
static TAManager getInstance()
          Delivers an instance of TAManager.
 void registerResource(TAResource resource)
          All resources, that should be managed, have to be registered to this manager.
 void removeResource(TAResource resource)
          Removes a resource from the list of registered resources.
 void rollback()
          Performs a rollback for all actions on the registered resources and closes the resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TAManager getInstance()
Delivers an instance of TAManager.

If it is the first call for the actual thread, a new TAManager -object will be created. Subsequent calls in this thread will deliver the object, that has been created by the first call.

Returns:
TAManager - instance of TAManager

registerResource

public void registerResource(TAResource resource)
All resources, that should be managed, have to be registered to this manager. The resource should be open at this point.

Parameters:
resource - Resource of the transaction, that should be managed.

removeResource

public void removeResource(TAResource resource)
Removes a resource from the list of registered resources.

Parameters:
resource - Resource of the transaction, that should be removed.

begin

public void begin()
           throws XException
Initializes a transaction. All registered resources will be opened.

Throws:
XException - if opening one ressource throws an XException.

commit

public void commit()
Commits all actions on the registered resources and closes the resources.


rollback

public void rollback()
Performs a rollback for all actions on the registered resources and closes the resources.


close

public void close()
Closes all registered resources.


clearManager

public void clearManager()

clear

public static void clear()