/** * Invoke {@link XAResourceConsumer} accept method before making sure that JMS connection is available. Current * connection is used if one is available. If connection is not available, new connection is created before the * accept call and closed after it. * * @param consumer {@link XAResourceConsumer} to be executed. * @throws XAException if JMS connection cannot be created. */ public void connectAndAccept(XAResourceConsumer consumer) throws XAException { if (isConnected()) { consumer.accept(session.getXAResource()); return; } connect(); try { consumer.accept(session.getXAResource()); } finally { disconnect(); } }
/** * Invoke {@link XAResourceConsumer} accept method before making sure that JMS connection is available. Current * connection is used if one is available. If connection is not available, new connection is created before the * accept call and closed after it. * * @param consumer {@link XAResourceConsumer} to be executed. * @throws XAException if JMS connection cannot be created. */ public void connectAndAccept(XAResourceConsumer consumer) throws XAException { if (isConnected()) { consumer.accept(session.getXAResource()); return; } connect(); try { consumer.accept(session.getXAResource()); } finally { disconnect(); } }
/** * Invoke {@link XAResourceConsumer} accept method before making sure that JMS connection is available. Current * connection is used if one is available. If connection is not available, new connection is created before the * accept call and closed after it. * * @param consumer {@link XAResourceConsumer} to be executed. * @throws XAException if JMS connection cannot be created. */ public void connectAndAccept(XAResourceConsumer consumer) throws XAException { if (isConnected()) { consumer.accept(session.getXAResource()); return; } connect(); try { consumer.accept(session.getXAResource()); } finally { disconnect(); } }