protected JMSSpecificContext context(final String id, final Object context) throws Exception { if (context != null) { return ((JMSSpecificContext)context).asNonCloseable(); } else { return (JMSSpecificContext)broker() .createContext(new HashMap<Messaging.CreateContextOption, Object>() {{ put(Messaging.CreateContextOption.CLIENT_ID, id); }}); } }
@Override public void stop() throws Exception { if (!this.stopped) { closeCloseables(); this.broker.destroyDestination(this); this.stopped = true; } }
@Override public void commit() { if (isTransacted()) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsSession().commit(); return null; } }); } }
public static String fullName(String name, JMSDestination.Type type) { if (isJndiName(name)) { return name; } else { return jmsName(name, type); } }
@Override public JMSSpecificContext createChildContext(Mode mode) { return new JMSContext(this.jmsConnection, broker(), mode, isRemote(), this); }
@Override public Session jmsSession() { if (this.jmsSession == null) { this.jmsSession = (Session) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsConnection.start(); return createJMSSession(); } }); addCloseable(this.jmsSession); } return this.jmsSession; }
protected javax.jms.Topic createRemoteTopic(final JMSSpecificContext context, final String name) { return (javax.jms.Topic) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { return context.jmsSession().createTopic(name); } }); }
@Override public boolean isRemote() { return this.remote || (this.parentContext != null && this.parentContext.isRemote()); }
@Override public Session jmsSession() { return JMSContext.this.jmsSession(); } }
@Override public void publish(Object content, Codec codec, Map<MessageOpOption, Object> options) throws Exception { publish(content, codec, options, Collections.EMPTY_MAP); }
public JMSListener(MessageHandler handler, Codecs codecs, Destination endpoint, JMSSpecificContext context, MessageConsumer consumer) { this.codecs = codecs; this.endpoint = endpoint; this.handler = handler; this.context = context; this.consumer = consumer; addCloseable(consumer); addCloseable(context); }
protected Object lookupJNDI(List<String> jndiNames) { for (String jndiName : jndiNames) { Object jndiObject = lookupJNDI(jndiName); if (jndiObject != null) { return jndiObject; } } return null; }
@Override public JMSSpecificContext createChildContext(Mode mode) { return this.asNonCloseable(); }
@Override public void acknowledge() { JMSContext.this.acknowledge(); }
@Override public Connection jmsConnection() { return JMSContext.this.jmsConnection(); }
@Override public void rollback() { if (isTransacted()) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsSession().rollback(); return null; } }); } }
@Override public void acknowledge() { if (this.latestMessage != null) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { JMSContext.this.latestMessage.jmsMessage().acknowledge(); return null; } }); } }
protected javax.jms.Queue createRemoteQueue(final JMSSpecificContext context, final String name) { return (javax.jms.Queue) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { return context.jmsSession().createQueue(name); } }); }