@Destroy public void destroy() throws JMSException { try { queueConnection.stop(); } catch (javax.jms.IllegalStateException e) { // as for JEE v5 specs, section EE 6.6 // At least WebSphere v7 enforce this log.warn("queueSession.stop() called during @Destroy in an invalid context for this container. Msg={0}", e.getMessage()); } queueConnection.close(); }
public void stop() { try { if (connection == null) throw new JMSException("Underlying connection is closed"); connection.stop(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException("Unable to close context", e.getMessage(), e); } catch (JMSException e) { throw new JMSRuntimeException("Cannot stop connection", e.getMessage(), e); } }
public void rollback() { connection.lockClientID(); try { session.rollback(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage()); } catch (JMSException e) { throw new JMSRuntimeException(e.getMessage()); } }
public void commit() { connection.lockClientID(); try { session.commit(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage()); } catch (JMSException e) { throw new JMSRuntimeException(e.getMessage()); } }
public void recover() { connection.lockClientID(); try { session.recover(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage()); } catch (JMSException e) { throw new JMSRuntimeException(e.getMessage()); } }
public void acknowledge() { connection.lockClientID(); try { session.acknowledge(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException("Unable to acknowledge", e.getMessage(), e); } catch (JMSException e) { logger.log(BasicLevel.ERROR, "Unable to acknowledge", e); throw new JMSRuntimeException(e.getMessage()); } }
public void sendJmsOneWay(Message msg) throws JMSException { open(); prepareMessage(msg); if (interceptorOut != null) interceptorOut.prepare(msg); log().d("sendJmsOneWay",dest,producer.getTimeToLive(),msg); try { producer.send(msg); } catch (IllegalStateException ise) { log().i("reconnect",getName(),ise.getMessage()); producer = null; open(); producer.send(msg); } }
producer.send(msg, deliveryMode, getPriority(), getTimeToLive()); } catch (IllegalStateException ise) { log().i("reconnect",getName(),ise.getMessage()); producer = null; open();
public void setClientID(String clientID) { try { if (lockClientID) throw new IllegalStateException("ClientID is already set by the provider."); if (connection == null) throw new JMSException("Underlying connection is closed"); connection.setClientID(clientID); lockClientID = true; } catch (InvalidClientIDException e) { throw new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (JMSException e) { throw new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e); } }
session.close(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException("Unable to close context", e.getMessage(), e); } catch (JMSException e) { throw new JMSRuntimeException("Unable to close context", e.getMessage(), e); connection.close(); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException("Unable to close context", e.getMessage(), e); } catch (JMSException e) { throw new JMSRuntimeException("Unable to close context", e.getMessage(), e);
producer.send(msg); } catch (IllegalStateException ise) { log().i("reconnect",getName(),ise.getMessage()); producer = null; open();
throw new InvalidDestinationRuntimeException(e.getMessage()); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage()); } catch (JMSException e) { throw new JMSRuntimeException(e.getMessage());
public JMSConsumer createDurableConsumer(Topic topic, String name, String selector, boolean noLocal) { connection.lockClientID(); try { MessageConsumer consumer = (MessageConsumer) session.createDurableConsumer(topic, name, selector, noLocal); return new JMSConsumer(consumer); } catch (InvalidDestinationException e) { throw new InvalidDestinationRuntimeException(e.getMessage()); } catch (InvalidSelectorException e) { throw new InvalidSelectorRuntimeException(e.getMessage()); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage()); } catch (JMSException e) { if (logger.isLoggable(BasicLevel.DEBUG)) logger.log(BasicLevel.DEBUG, "Unable to instantiate a JMSConsumer" + e.getMessage()); throw new JMSRuntimeException("Unable to instantiate a JMSConsumer"); } finally { if (connection.getAutoStart()) connection.start(); } }
public javax.jms.JMSConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName, String messageSelector) { connection.lockClientID(); try { return new JMSConsumer(session.createSharedConsumer(topic, sharedSubscriptionName, messageSelector)); } catch (InvalidDestinationException e) { throw new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (InvalidSelectorException e) { throw new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (JMSException e) { if (logger.isLoggable(BasicLevel.DEBUG)) logger.log(BasicLevel.DEBUG, "Unable to crate shared consumer " + e.getMessage()); throw new JMSRuntimeException("Unable to create shared consumer " + e.getMessage(), e.getErrorCode(), e); } finally { if (connection.getAutoStart()) connection.start(); } }
public javax.jms.JMSConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector) { connection.lockClientID(); try { return new JMSConsumer(session.createSharedDurableConsumer(topic, name, messageSelector)); } catch (InvalidDestinationException e) { throw new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (InvalidSelectorException e) { throw new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (IllegalStateException e) { throw new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e); } catch (JMSException e) { if (logger.isLoggable(BasicLevel.DEBUG)) logger.log(BasicLevel.DEBUG, "Unable to crate shared durable consumer " + e.getMessage()); throw new JMSRuntimeException("Unable to create shared durable consumer " + e.getMessage(), e.getErrorCode(), e); } finally { if (connection.getAutoStart()) connection.start(); } }