Package bitronix.tm.resource.common
Class ResourceBean
java.lang.Object
bitronix.tm.resource.common.ResourceBean
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
EhCacheXAResourceProducer,PoolingConnectionFactory,PoolingConnectionFactory,PoolingDataSource
Abstract javabean container for all common properties of a
XAResourceProducer as configured in the
resources configuration file.- Author:
- lorban
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitialize all properties with their default values. -
Method Summary
Modifier and TypeMethodDescriptionintintintbooleanbooleanbooleanbooleanbooleanintintintbooleanintbooleanintIncrement a transient counter.booleanvoidsetAcquireIncrement(int acquireIncrement) Define the amount of connections to be created at once when the pool needs to grow.voidsetAcquisitionInterval(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.voidsetAcquisitionTimeout(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.voidsetAllowLocalTransactions(boolean allowLocalTransactions) Set if the transaction manager should allow mixing XA and non-XA transactions.voidsetApplyTransactionTimeout(boolean applyTransactionTimeout) Set if the transaction-timeout should be set on the XAResource when the XAResource is enlisted.voidsetAutomaticEnlistingEnabled(boolean automaticEnlistingEnabled) Specify if the XA resource wrapper should enlist/delist this resource automatically in global transactions.voidsetClassName(String className) Specify the underlying implementation class name of the XA resource described by this bean.voidsetDeferConnectionRelease(boolean deferConnectionRelease) Define the transaction interleaving capability of the database.voidsetDisabled(boolean disabled) Set whether this resource is disabled, meaning it's temporarily forbidden to acquire a connection from its pool.voidsetDriverProperties(Properties driverProperties) Set the properties that should be set on the underlying implementation.voidsetIgnoreRecoveryFailures(boolean ignoreRecoveryFailures) Set whether XA recovery errors should quarantine the resource or be ignored.voidsetMaxIdleTime(int maxIdleTime) Define the amount of seconds and idle connection can stay in the pool before getting closed.voidsetMaxPoolSize(int maxPoolSize) Define the maximum amount of connections that can be in the pool.voidsetMinPoolSize(int minPoolSize) Define the minimal amount of connections that can be in the pool.voidsetShareTransactionConnections(boolean shareAccessibleConnections) Set whether connections in the ACCESSIBLE state can be shared within the context of a transaction.voidsetTwoPcOrderingPosition(int twoPcOrderingPosition) Set the position at which this resource should stand during 2PC commit.voidsetUniqueName(String uniqueName) Specify the resource unique name to be used to identify this resource during recovery.voidsetUseTmJoin(boolean useTmJoin) Specify if the transaction manager should try to join resources by callingXAResource.start(javax.transaction.xa.Xid, int)withXAResource.TMJOIN.
-
Constructor Details
-
ResourceBean
protected ResourceBean()Initialize all properties with their default values.
-
-
Method Details
-
getClassName
- Returns:
- the underlying implementation class name.
-
setClassName
Specify the underlying implementation class name of the XA resource described by this bean.- Parameters:
className- the underlying implementation class name.
-
getUniqueName
- Returns:
- the resource's unique name.
-
setUniqueName
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 withTransaction.enlistResource(javax.transaction.xa.XAResource)and delist themTransaction.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 callingXAResource.start(javax.transaction.xa.Xid, int)withXAResource.TMJOIN. The transaction manager checks if two branches can be joined by callingXAResource.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
- Returns:
- the properties that should be set on the underlying implementation.
-
setDriverProperties
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.
-
setIgnoreRecoveryFailures
public void setIgnoreRecoveryFailures(boolean ignoreRecoveryFailures) Set whether XA recovery errors should quarantine the resource or be ignored.- Parameters:
ignoreRecoveryFailures- true if recovery errors should be ignored, false otherwise.
-
getIgnoreRecoveryFailures
public boolean getIgnoreRecoveryFailures()- Returns:
- true if recovery errors should be ignored, false otherwise.
-
setDisabled
public void setDisabled(boolean disabled) Set whether this resource is disabled, meaning it's temporarily forbidden to acquire a connection from its pool.- Parameters:
disabled- true to disable the resource, false to enable it.
-
isDisabled
public boolean isDisabled()- Returns:
- true if the resource is disabled, false if it is enabled.
-
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.
-