activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <>
Subject Questions for ActiveMQResourceAdapter.getXAResources method in ActiveMQ RA module
Date Tue, 28 Dec 2010 02:29:18 GMT
    I am learning the ActiveMQ RA module, and could not understand some
codes in the getXAResources method of ActiveMQResourceAdapter class, please
help to give some comments, thanks.
    a. The implementation class of XAResource is
org.apache.activemq.TransactionContext, and it holds a reference to a
ActiveMQConnection, so is it reasonable to close the connection in the
finally block ?
    b. Sometimes, while calling the connection.close() method, the
wireformat handshaking is not finished, and some EOFException or Socket
reset exception is always thrown, although it might not cause problems, it
seems to be annoying. So if the XaSession is only created by
ActiveMQXAConnection, and ActiveMQXAConnection could only be created by
ActiveMQXAConnectionFactory, so how about checking whether the connection
factory is an instance of XAConnectionFactory.
    If I do not miss anything, I could try to open a JIRA and create a

    public XAResource[] getXAResources(ActivationSpec[] activationSpecs)
throws ResourceException {
        Connection connection = null;
        try {
            connection = makeConnection();
            if (connection instanceof XAConnection) {
                XASession session =
                XAResource xaResource = session.getXAResource();
                return new XAResource[] {
            return new XAResource[] {};
        } catch (JMSException e) {
            throw new ResourceException(e);
        } finally {
            try {
            } catch (Throwable ignore) {


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message