com.atomikos.icatch.ws
Class ApplicationClasspathResource

java.lang.Object
  extended by com.atomikos.icatch.ws.ApplicationClasspathResource
All Implemented Interfaces:
RecoverableResource

public abstract class ApplicationClasspathResource
extends Object
implements RecoverableResource


Field Summary
protected  UniqueIdMgr idMgr
           
protected  Map idToParticipantMap
           
protected  String name
           
protected  ObjectLog participantLog
           
 
Constructor Summary
protected ApplicationClasspathResource(String name, String logBaseDir, String logBaseName, long checkPointInterval)
           
 
Method Summary
 void close()
          Closes the resource for shutdown.
 void endRecovery()
          Notifies the resource that recovery is ended.
 String getName()
          Gets the name of the resource.
protected static ApplicationClasspathResource getResourceForClassLoader(ClassLoader cl)
           
 boolean isClosed()
          Tests if the resource is closed.
 boolean isSameRM(RecoverableResource res)
          Tests if a resource is the same as another one.
protected abstract  void recoverAllIfNeeded()
           
static void registerResource(ApplicationClasspathResource resource, ClassLoader cl)
          Registers a resource.
 void removeParticipant(String id)
           
 void setRecoveryService(RecoveryService recoveryService)
          Initializes this resource with the recovery service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atomikos.datasource.RecoverableResource
recover
 

Field Detail

name

protected String name

participantLog

protected ObjectLog participantLog

idToParticipantMap

protected Map idToParticipantMap

idMgr

protected UniqueIdMgr idMgr
Constructor Detail

ApplicationClasspathResource

protected ApplicationClasspathResource(String name,
                                       String logBaseDir,
                                       String logBaseName,
                                       long checkPointInterval)
                                throws ResourceException
Throws:
ResourceException
Method Detail

registerResource

public static void registerResource(ApplicationClasspathResource resource,
                                    ClassLoader cl)
Registers a resource.

Parameters:
resource -
cl -

getResourceForClassLoader

protected static ApplicationClasspathResource getResourceForClassLoader(ClassLoader cl)

setRecoveryService

public void setRecoveryService(RecoveryService recoveryService)
                        throws ResourceException
Description copied from interface: RecoverableResource
Initializes this resource with the recovery service. This method is called by the transaction service during intialization of the transaction service or when the resource is added, whichever comes last. If the resource wants to recover, it should subsequently ask the recoveryService to do so.

Specified by:
setRecoveryService in interface RecoverableResource
Parameters:
recoveryService - The recovery service. This instance can be used by the resource to ask recovery from the transaction engine.
Throws:
ResourceException - On errors.

removeParticipant

public void removeParticipant(String id)

endRecovery

public void endRecovery()
                 throws ResourceException
Description copied from interface: RecoverableResource
Notifies the resource that recovery is ended. Called by TM at end of recovery; any remaining resourcetransactions (i.e., that have not been associated with any recover call) should be rolled back. This is because if the were not recovered by the TM, then surely they are not supposed to be indoubt (the TM recovers ALL indoubt work!) and should be rolled back.

Specified by:
endRecovery in interface RecoverableResource
Throws:
ResourceException - On failure.

close

public void close()
           throws ResourceException
Description copied from interface: RecoverableResource
Closes the resource for shutdown. This notifies the resource that it is no longer needed.

Specified by:
close in interface RecoverableResource
Throws:
ResourceException

getName

public String getName()
Description copied from interface: RecoverableResource
Gets the name of the resource. Names should be unique within one TM domain.

Specified by:
getName in interface RecoverableResource
Returns:
String The name.

isSameRM

public boolean isSameRM(RecoverableResource res)
                 throws ResourceException
Description copied from interface: RecoverableResource
Tests if a resource is the same as another one.

Specified by:
isSameRM in interface RecoverableResource
Throws:
ResourceException

isClosed

public boolean isClosed()
Description copied from interface: RecoverableResource
Tests if the resource is closed.

Specified by:
isClosed in interface RecoverableResource
Returns:
boolean True if the resource is closed.

recoverAllIfNeeded

protected abstract void recoverAllIfNeeded()


Copyright © 2012. All Rights Reserved.