|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atomikos.jms.AtomikosConnectionFactoryBean
public class AtomikosConnectionFactoryBean
This class represents the Atomikos JMS 1.1 connection factory for JTA-enabled JMS.
Use an instance of this class to make JMS participate in JTA transactions without
having to issue the low-level XA calls yourself. The following use cases are supported:
localTransactionMode
is set to false (default), and
Transaction tx = ...; //start a JTA transaction
...
AtomikosConnectionFactoryBean cf = ...; //create or retrieve a connection factory instance
...
Connection c = cf.createConnection();
Session s = c.createSession ( true , 0 ); //note the value of the transacted flag!
...//perform regular JMS sends or receives
...
tx.commit(); //commit JTA transaction to make all JMS operations take effect, or rollback to cancel everything
XAConnectionFactory
is that this class takes care of all JTA/XA-related
calls towards the driver underneath. In other words, it hides the complexities of JTA/XA at the driver level.
localTransactionMode
is set to true, and
AtomikosConnectionFactoryBean cf = ...; //create or retrieve a connection factory instance
...
Connection c = cf.createConnection();
Session s = c.createSession ( true , 0 ); //note the value of the transacted flag!
...//perform regular JMS sends or receives
...
s.commit();//commit on session to make all effects permanent, rollback to cancel
AtomikosConnectionFactoryBean cf = ...; //create or retrieve a connection factory instance
...
Connection c = cf.createConnection();
Session s = c.createSession ( false , ... ); //note the value of the transacted flag!
Note: this mode requires support from your JMS vendor's XAConnectionFactory implementation. Check your vendor documentation first!
Constructor Summary | |
---|---|
AtomikosConnectionFactoryBean()
|
Method Summary | |
---|---|
void |
close()
Closes the instance. |
javax.jms.Connection |
createConnection()
|
javax.jms.Connection |
createConnection(String user,
String password)
|
protected ConnectionFactory |
doInit()
|
int |
getBorrowConnectionTimeout()
Gets the timeout for borrowing connections from the pool. |
int |
getDefaultIsolationLevel()
Gets the default isolation level preference. |
boolean |
getLocalTransactionMode()
Gets the local transaction mode. |
int |
getMaintenanceInterval()
Gets the pool maintenance interval. |
int |
getMaxIdleTime()
Gets the max idle time for connections in the pool. |
int |
getMaxPoolSize()
Gets the max size of the pool. |
int |
getMinPoolSize()
Gets the min size of the pool. |
int |
getReapTimeout()
Gets the reap timeout of the pool. |
Reference |
getReference()
|
String |
getTestQuery()
Gets a test query, currently defaults to null (not applicable to JMS). |
String |
getUniqueResourceName()
Gets the unique name for this resource. |
javax.jms.XAConnectionFactory |
getXaConnectionFactory()
Gets the configured XAConnectionFactory. |
String |
getXaConnectionFactoryClassName()
Gets the name of the vendor-specific XAConnectionFactory class implementation. |
Properties |
getXaProperties()
Gets the vendor-specific XA properties to set. |
void |
init()
Initializes the instance. |
protected String |
printXaProperties()
|
void |
setBorrowConnectionTimeout(int timeout)
Sets the max timeout that connection requests should wait when no connection is available in the pool. |
void |
setLocalTransactionMode(boolean mode)
Sets whether or not local transactions are desired. |
void |
setMaintenanceInterval(int interval)
Sets the pool maintenance interval, i.e. |
void |
setMaxIdleTime(int time)
Sets the max idle time after which connections are cleaned up from the pool. |
void |
setMaxPoolSize(int maxPoolSize)
Sets the max size that the pool can reach. |
void |
setMinPoolSize(int minPoolSize)
Sets the min size of the pool. |
void |
setPoolSize(int minAndMaxSize)
Sets both the min and max size of the pool. |
void |
setReapTimeout(int timeout)
Sets the reap timeout for connections. |
void |
setUniqueResourceName(String resourceName)
Sets the unique resource name for this resource, needed for recovery of transactions after restart. |
void |
setXaConnectionFactory(javax.jms.XAConnectionFactory xaConnectionFactory)
Sets the XAConnectionFactory directly, instead of calling setXaConnectionFactoryClassName and setXaProperties. |
void |
setXaConnectionFactoryClassName(String xaConnectionFactoryClassName)
Sets the fully qualified name of a vendor-specific implementation of XAConnectionFatory. |
void |
setXaProperties(Properties xaProperties)
Sets the vendor-specific XA properties. |
protected void |
throwAtomikosJMSException(String msg)
|
protected void |
throwAtomikosJMSException(String msg,
Throwable cause)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AtomikosConnectionFactoryBean()
Method Detail |
---|
protected void throwAtomikosJMSException(String msg) throws AtomikosJMSException
AtomikosJMSException
protected void throwAtomikosJMSException(String msg, Throwable cause) throws AtomikosJMSException
AtomikosJMSException
public int getMaxPoolSize()
getMaxPoolSize
in interface ConnectionPoolProperties
public void setMaxPoolSize(int maxPoolSize)
maxPoolSize
- public int getMinPoolSize()
getMinPoolSize
in interface ConnectionPoolProperties
public void setMinPoolSize(int minPoolSize)
minPoolSize
- public void setPoolSize(int minAndMaxSize)
minAndMaxSize
- public String getUniqueResourceName()
getUniqueResourceName
in interface ConnectionPoolProperties
public void setUniqueResourceName(String resourceName)
resourceName
- public String getXaConnectionFactoryClassName()
public void setXaConnectionFactoryClassName(String xaConnectionFactoryClassName)
xaConnectionFactoryClassName
- XAConnectionFactory
public Properties getXaProperties()
public void setXaProperties(Properties xaProperties)
xaProperties
- The properties, to be set (during initialization) on the
specified XAConnectionFactory implementation.public javax.jms.XAConnectionFactory getXaConnectionFactory()
public void setXaConnectionFactory(javax.jms.XAConnectionFactory xaConnectionFactory)
xaConnectionFactory
- public void init() throws javax.jms.JMSException
javax.jms.JMSException
protected String printXaProperties()
protected ConnectionFactory doInit() throws Exception
Exception
public int getBorrowConnectionTimeout()
getBorrowConnectionTimeout
in interface ConnectionPoolProperties
public int getMaintenanceInterval()
getMaintenanceInterval
in interface ConnectionPoolProperties
public int getMaxIdleTime()
getMaxIdleTime
in interface ConnectionPoolProperties
public int getReapTimeout()
getReapTimeout
in interface ConnectionPoolProperties
public String getTestQuery()
getTestQuery
in interface ConnectionPoolProperties
public void setBorrowConnectionTimeout(int timeout)
timeout
- The timeout in seconds.public void setMaintenanceInterval(int interval)
interval
- public void setMaxIdleTime(int time)
time
- public void setReapTimeout(int timeout)
timeout
- public boolean getLocalTransactionMode()
getLocalTransactionMode
in interface ConnectionPoolProperties
public void setLocalTransactionMode(boolean mode)
mode
- public int getDefaultIsolationLevel()
ConnectionPoolProperties
getDefaultIsolationLevel
in interface ConnectionPoolProperties
public void close()
public String toString()
toString
in class Object
public javax.jms.Connection createConnection() throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException
ConnectionFactory
public javax.jms.Connection createConnection(String user, String password) throws javax.jms.JMSException
createConnection
in interface javax.jms.ConnectionFactory
javax.jms.JMSException
ConnectionFactory
public Reference getReference() throws NamingException
getReference
in interface Referenceable
NamingException
Referenceable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |