bitronix.tm.resource.common
Class ResourceBean

java.lang.Object
  extended by bitronix.tm.resource.common.ResourceBean
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
PoolingConnectionFactory, PoolingDataSource

public abstract class ResourceBean
extends java.lang.Object
implements java.io.Serializable

Abstract javabean container for all common properties of a XAResourceProducer as configured in the resources configuration file.

© Bitronix Software

Author:
lorban
See Also:
Serialized Form

Constructor Summary
protected ResourceBean()
          Initialize all properties with their default values.
 
Method Summary
 int getAcquireIncrement()
           
 int getAcquisitionInterval()
           
 int getAcquisitionTimeout()
           
 boolean getAllowLocalTransactions()
           
 boolean getApplyTransactionTimeout()
           
 boolean getAutomaticEnlistingEnabled()
           
 java.lang.String getClassName()
           
 boolean getDeferConnectionRelease()
           
 java.util.Properties getDriverProperties()
           
 int getMaxIdleTime()
           
 int getMaxPoolSize()
           
 int getMinPoolSize()
           
 int getTwoPcOrderingPosition()
           
 java.lang.String getUniqueName()
           
 boolean getUseTmJoin()
           
 int incCreatedResourcesCounter()
          Increment a transient counter.
 void setAcquireIncrement(int acquireIncrement)
          Define the amount of connections to be created at once when the pool needs to grow.
 void setAcquisitionInterval(int acquisitionInterval)
          Set the amount of time in seconds the pool will wait before trying to acquire a connection again after an invalid connection has been attempted to be acquired.
 void setAcquisitionTimeout(int acquisitionTimeout)
          Define the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty.
 void setAllowLocalTransactions(boolean allowLocalTransactions)
          Set if the transaction manager should allow mixing XA and non-XA transactions.
 void setApplyTransactionTimeout(boolean applyTransactionTimeout)
          Set if the transaction-timeout should be set on the XAResource when the XAResource is enlisted.
 void setAutomaticEnlistingEnabled(boolean automaticEnlistingEnabled)
          Specify if the XA resource wrapper should enlist/delist this resource automatically in global transactions.
 void setClassName(java.lang.String className)
          Specify the underlying implementation class name of the XA resource described by this bean.
 void setDeferConnectionRelease(boolean deferConnectionRelease)
          Define the transaction interleaving capability of the database.
 void setDriverProperties(java.util.Properties driverProperties)
          Set the properties that should be set on the underlying implementation.
 void setMaxIdleTime(int maxIdleTime)
          Define the amount of seconds and idle connection can stay in the pool before getting closed.
 void setMaxPoolSize(int maxPoolSize)
          Define the maximum amount of connections that can be in the pool.
 void setMinPoolSize(int minPoolSize)
          Define the minimal amount of connections that can be in the pool.
 void setTwoPcOrderingPosition(int twoPcOrderingPosition)
          Set the position at which this resource should stand during 2PC commit.
 void setUniqueName(java.lang.String uniqueName)
          Specify the resource unique name to be used to identify this resource during recovery.
 void setUseTmJoin(boolean useTmJoin)
          Specify if the transaction manager should try to join resources by calling XAResource.start(javax.transaction.xa.Xid, int) with XAResource.TMJOIN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBean

protected ResourceBean()
Initialize all properties with their default values.

Method Detail

getClassName

public java.lang.String getClassName()
Returns:
the underlying implementation class name.

setClassName

public void setClassName(java.lang.String className)
Specify the underlying implementation class name of the XA resource described by this bean.

Parameters:
className - the underlying implementation class name.

getUniqueName

public java.lang.String getUniqueName()
Returns:
the resource's unique name.

setUniqueName

public void setUniqueName(java.lang.String uniqueName)
Specify the resource unique name to be used to identify this resource during recovery. This name will be registered in the transactions journal so once assigned it must never be changed.

Parameters:
uniqueName - the resource's unique name.

getAutomaticEnlistingEnabled

public boolean getAutomaticEnlistingEnabled()
Returns:
true if the the XA resource wrapper should enlist/delist this resource automatically in global transactions.

setAutomaticEnlistingEnabled

public void setAutomaticEnlistingEnabled(boolean automaticEnlistingEnabled)
Specify if the XA resource wrapper should enlist/delist this resource automatically in global transactions. When set to false, you have to enlist resources yourself with Transaction.enlistResource(javax.transaction.xa.XAResource) and delist them Transaction.delistResource(javax.transaction.xa.XAResource, int).

Parameters:
automaticEnlistingEnabled - true if the the XA resource wrapper should enlist/delist this resource automatically in global transactions.

getUseTmJoin

public boolean getUseTmJoin()
Returns:
true if transaction branches joining should be used.

setUseTmJoin

public void setUseTmJoin(boolean useTmJoin)
Specify if the transaction manager should try to join resources by calling XAResource.start(javax.transaction.xa.Xid, int) with XAResource.TMJOIN. The transaction manager checks if two branches can be joined by calling XAResource.isSameRM(javax.transaction.xa.XAResource). It should only be set to true if the underlying implementation supports resource joining.

Parameters:
useTmJoin - true if transaction branches joining should be used.

getDriverProperties

public java.util.Properties getDriverProperties()
Returns:
the properties that should be set on the underlying implementation.

setDriverProperties

public void setDriverProperties(java.util.Properties driverProperties)
Set the properties that should be set on the underlying implementation.

Parameters:
driverProperties - the properties that should be set on the underlying implementation.

getMaxPoolSize

public int getMaxPoolSize()
Returns:
the maximum amount of connections that can be in the pool.

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Define the maximum amount of connections that can be in the pool.

Parameters:
maxPoolSize - the maximum amount of connections that can be in the pool.

getMinPoolSize

public int getMinPoolSize()
Returns:
the minimal amount of connections that can be in the pool.

setMinPoolSize

public void setMinPoolSize(int minPoolSize)
Define the minimal amount of connections that can be in the pool.

Parameters:
minPoolSize - the maximum amount of connections that can be in the pool.

getMaxIdleTime

public int getMaxIdleTime()
Returns:
the amount of seconds and idle connection can stay in the pool before getting closed.

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Define the amount of seconds and idle connection can stay in the pool before getting closed.

Parameters:
maxIdleTime - the amount of seconds and idle connection can stay in the pool before getting closed.

getAcquireIncrement

public int getAcquireIncrement()
Returns:
the amount of connections to be created at once when the pool needs to grow.

setAcquireIncrement

public void setAcquireIncrement(int acquireIncrement)
Define the amount of connections to be created at once when the pool needs to grow.

Parameters:
acquireIncrement - the amount of connections to be created at once when the pool needs to grow.

getAcquisitionTimeout

public int getAcquisitionTimeout()
Returns:
the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty.

setAcquisitionTimeout

public void setAcquisitionTimeout(int acquisitionTimeout)
Define the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty.

Parameters:
acquisitionTimeout - the amount of time in seconds.

getDeferConnectionRelease

public boolean getDeferConnectionRelease()
Returns:
false only if the database can run many transactions on the same connection.

setDeferConnectionRelease

public void setDeferConnectionRelease(boolean deferConnectionRelease)
Define the transaction interleaving capability of the database. Should be true only if the database can run many transactions on the same connection.

Parameters:
deferConnectionRelease - false only if the database can run many transactions on the same connection.

getAcquisitionInterval

public int getAcquisitionInterval()
Returns:
the amount of time between failed connection acquirements.

setAcquisitionInterval

public void setAcquisitionInterval(int acquisitionInterval)
Set the amount of time in seconds the pool will wait before trying to acquire a connection again after an invalid connection has been attempted to be acquired.

Parameters:
acquisitionInterval - amount of time in seconds.

getAllowLocalTransactions

public boolean getAllowLocalTransactions()
Returns:
true if the transaction manager should allow mixing XA and non-XA transactions.

setAllowLocalTransactions

public void setAllowLocalTransactions(boolean allowLocalTransactions)
Set if the transaction manager should allow mixing XA and non-XA transactions. If you know all your transactions should be executed within global (ie: XA) scope it is a good idea to set this property to false.

Parameters:
allowLocalTransactions - if the transaction manager should allow mixing XA and non-XA transactions.

getTwoPcOrderingPosition

public int getTwoPcOrderingPosition()
Returns:
the position at which this resource should stand during 2PC commit.

setTwoPcOrderingPosition

public void setTwoPcOrderingPosition(int twoPcOrderingPosition)
Set the position at which this resource should stand during 2PC commit.

Parameters:
twoPcOrderingPosition - the position at which this resource should stand during 2PC commit.

getApplyTransactionTimeout

public boolean getApplyTransactionTimeout()
Returns:
true if the transaction-timeout should be set on the XAResource.

setApplyTransactionTimeout

public void setApplyTransactionTimeout(boolean applyTransactionTimeout)
Set if the transaction-timeout should be set on the XAResource when the XAResource is enlisted.

Parameters:
applyTransactionTimeout - true if the transaction-timeout should be set.

incCreatedResourcesCounter

public int incCreatedResourcesCounter()
Increment a transient counter. This is used for assigning per-resource numbers to connections.

Returns:
the current value of the counter.