Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.atomikos.datasource
Interface RecoverableResource

All Known Subinterfaces:
  TransactionalResource, Transport

All Known Implementing Classes:
  AbstractTransport, AcceptAllXATransactionalResource, ApplicationClasspathResource, AtomikosHttpTransport, HttpTransport, JcaTransactionalResource, JdbcTransactionalResource, JmsTransactionalResource, TemporaryXATransactionalResource, WsatHttpTransport, XATransactionalResource

    public interface RecoverableResource

A Recoverable Resource is the abstraction of a resource that supports recoverable work (i.e., that supports Participant instances). Its primary use is for Participant instances that are not self-containing, as for instance in XA transactions (where the Participant can not contain the entire transaction context of the server, but only an external reference to it in the form of an Xid instance). A recoverable resource is invoked at recovery time by its own Participant instances (typically in the readExternal method), who iteratively ask each resource in the com.atomikos.icatch.Configuration whether or not they can be recovered by them. At the end of recovery, the TM will invoke the endRecovery method, to indicate to the resource that whatever private logs it has, any remaining and non-recovered participants should be aborted.

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.
`boolean` | `isClosed()` Tests if the resource is closed.
`boolean` | `isSameRM(RecoverableResource res)` Tests if a resource is the same as another one.
`boolean` | `recover(Participant participant)` Recovers the partially reconstructed Participant.
`void` | `setRecoveryService(RecoveryService recoveryService)` Initializes this resource with the recovery service.

Method Detail

### setRecoveryService

    void setRecoveryService(RecoveryService recoveryService)
                            throws ResourceException

  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.

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

### recover

    boolean recover(Participant participant)
                    throws ResourceException

  Recovers the partially reconstructed Participant.

  Parameters:
    `participant` - A partially recovered Participant.
  Returns:
    boolean True iff reconstruction was successful. If the resource is not responsible for the given participant, then this will return false. A Participant can use this to iterate over all resources in order to eventually recover itself. This is particularly useful if the Participant instance can not serialize its full state, because some of it is on its backside resource (as, for instance, in XA). This way, the TransactionalResource can be used to assist in reconstruction of the Participant's state.
  Throws:
    `ResourceException` - On failure.

### endRecovery

    void endRecovery()
                     throws ResourceException

  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.

  Throws:
    `ResourceException` - On failure.

### close

    void close()
               throws ResourceException

  Closes the resource for shutdown. This notifies the resource that it is no longer needed.

  Throws:
    `ResourceException`

### getName

    String getName()

  Gets the name of the resource. Names should be unique within one TM domain.

  Returns:
    String The name.

### isSameRM

    boolean isSameRM(RecoverableResource res)
                     throws ResourceException

  Tests if a resource is the same as another one.

  Throws:
    `ResourceException`

### isClosed

    boolean isClosed()

  Tests if the resource is closed.

  Returns:
    boolean True if the resource is closed.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.