bitronix.tm.resource.common
Interface XAResourceProducer

All Superinterfaces:
javax.naming.Referenceable, java.io.Serializable
All Known Implementing Classes:
PoolingConnectionFactory, PoolingDataSource

public interface XAResourceProducer
extends javax.naming.Referenceable, java.io.Serializable

A XAResourceProducer is a XAStatefulHolder factory. It must be implemented by any class that is able to produce pooled XA connections.

© Bitronix Software

Author:
lorban

Method Summary
 void close()
          Release this XAResourceProducer's internal resources.
 XAStatefulHolder createPooledConnection(java.lang.Object xaFactory, ResourceBean bean)
          Create a XAStatefulHolder that will be placed in an XAPool.
 void endRecovery()
          Release internal resources held after call to startRecovery().
 XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
          Find in the XAResourceHolders created by this XAResourceProducer the one which this XAResource belongs to.
 java.lang.String getUniqueName()
          Get the resource name as registered in the transactions journal.
 void init()
          Initialize this XAResourceProducer's internal resources.
 void setFailed(boolean failed)
          Mark this resource producer as failed or not.
 XAResourceHolderState startRecovery()
          Prepare the recoverable XAResource producer for recovery.
 
Methods inherited from interface javax.naming.Referenceable
getReference
 

Method Detail

getUniqueName

java.lang.String getUniqueName()
Get the resource name as registered in the transactions journal.

Returns:
the unique name of the resource.

startRecovery

XAResourceHolderState startRecovery()
                                    throws RecoveryException
Prepare the recoverable XAResource producer for recovery.

Returns:
a XAResourceHolderState object that can be used to call recover().
Throws:
RecoveryException - thrown when a XAResourceHolderState cannot be acquired.

endRecovery

void endRecovery()
                 throws RecoveryException
Release internal resources held after call to startRecovery().

Throws:
RecoveryException - thrown when an error occured while releasing reserved resources.

setFailed

void setFailed(boolean failed)
Mark this resource producer as failed or not. A resource is considered failed if recovery fails to run on it.

Parameters:
failed - true is the resource must be considered failed, false it it must be considered sane.

findXAResourceHolder

XAResourceHolder findXAResourceHolder(javax.transaction.xa.XAResource xaResource)
Find in the XAResourceHolders created by this XAResourceProducer the one which this XAResource belongs to.

Parameters:
xaResource - the XAResource to look for.
Returns:
the associated XAResourceHolder or null if the XAResource does not belong to this XAResourceProducer.

init

void init()
Initialize this XAResourceProducer's internal resources.


close

void close()
Release this XAResourceProducer's internal resources.


createPooledConnection

XAStatefulHolder createPooledConnection(java.lang.Object xaFactory,
                                        ResourceBean bean)
                                        throws java.lang.Exception
Create a XAStatefulHolder that will be placed in an XAPool.

Parameters:
xaFactory - the vendor's resource-specific XA factory.
bean - the resource-specific bean describing the resource parameters.
Returns:
a XAStatefulHolder that will be placed in an XAPool.
Throws:
java.lang.Exception - thrown when the XAStatefulHolder cannot be created.