Methods Summary |
---|
void | addConsumer(javax.jms.MessageConsumer consumer)
synchronized (consumers)
{
consumers.add(consumer);
}
|
void | addProducer(javax.jms.MessageProducer producer)
synchronized (producers)
{
producers.add(producer);
}
|
void | checkStrict()
if (mc != null && mc.getManagedConnectionFactory().isStrict())
throw new IllegalStateException(JmsSessionFactory.ISE);
|
public void | close()Closes the session. Sends a ConnectionEvent.CONNECTION_CLOSED to the
managed connection.
sf.closeSession(this);
closeSession();
|
void | closeSession()
if (mc != null)
{
log.trace("Closing session");
try
{
mc.stop();
}
catch (Throwable t)
{
log.trace("Error stopping managed connection", t);
}
synchronized (consumers)
{
for (Iterator i = consumers.iterator(); i.hasNext();)
{
JmsMessageConsumer consumer = (JmsMessageConsumer) i.next();
try
{
consumer.closeConsumer();
}
catch (Throwable t)
{
log.trace("Error closing consumer", t);
}
i.remove();
}
}
synchronized (producers)
{
for (Iterator i = producers.iterator(); i.hasNext();)
{
MessageProducer producer = (MessageProducer) i.next();
try
{
producer.close();
}
catch (Throwable t)
{
log.trace("Error closing producer", t);
}
i.remove();
}
}
mc.removeHandle(this);
ConnectionEvent ev = new ConnectionEvent(mc, ConnectionEvent.CONNECTION_CLOSED);
ev.setConnectionHandle(this);
mc.sendEvent(ev);
mc = null;
}
|
public void | commit()
Session session = getSession();
if (info.isTransacted() == false)
throw new IllegalStateException("Session is not transacted");
if (trace)
log.trace("Commit session " + this);
session.commit();
|
public javax.jms.QueueBrowser | createBrowser(javax.jms.Queue queue)
if(info.getType() == JmsConnectionFactory.TOPIC)
{
throw new IllegalStateException("Cannot create browser for javax.jms.TopicSession");
}
Session session = getSession();
if (trace)
log.trace("createBrowser " + session + " queue=" + queue);
QueueBrowser result = session.createBrowser(queue);
if (trace)
log.trace("createdBrowser " + session + " browser=" + result);
return result;
|
public javax.jms.QueueBrowser | createBrowser(javax.jms.Queue queue, java.lang.String messageSelector)
Session session = getSession();
if (trace)
log.trace("createBrowser " + session + " queue=" + queue + " selector=" + messageSelector);
QueueBrowser result = session.createBrowser(queue, messageSelector);
if (trace)
log.trace("createdBrowser " + session + " browser=" + result);
return result;
|
public javax.jms.BytesMessage | createBytesMessage()
Session session = getSession();
if (trace)
log.trace("createBytesMessage" + session);
return session.createBytesMessage();
|
public javax.jms.MessageConsumer | createConsumer(javax.jms.Destination destination)
Session session = getSession();
if (trace)
log.trace("createConsumer " + session + " dest=" + destination);
MessageConsumer result = session.createConsumer(destination);
result = new JmsMessageConsumer(result, this);
if (trace)
log.trace("createdConsumer " + session + " consumer=" + result);
addConsumer(result);
return result;
|
public javax.jms.MessageConsumer | createConsumer(javax.jms.Destination destination, java.lang.String messageSelector)
Session session = getSession();
if (trace)
log.trace("createConsumer " + session + " dest=" + destination + " messageSelector=" + messageSelector);
MessageConsumer result = session.createConsumer(destination, messageSelector);
result = new JmsMessageConsumer(result, this);
if (trace)
log.trace("createdConsumer " + session + " consumer=" + result);
addConsumer(result);
return result;
|
public javax.jms.MessageConsumer | createConsumer(javax.jms.Destination destination, java.lang.String messageSelector, boolean noLocal)
Session session = getSession();
if (trace)
log.trace("createConsumer " + session + " dest=" + destination + " messageSelector=" + messageSelector + " noLocal=" + noLocal);
MessageConsumer result = session.createConsumer(destination, messageSelector, noLocal);
result = new JmsMessageConsumer(result, this);
if (trace)
log.trace("createdConsumer " + session + " consumer=" + result);
addConsumer(result);
return result;
|
public javax.jms.TopicSubscriber | createDurableSubscriber(javax.jms.Topic topic, java.lang.String name)
if(info.getType() == JmsConnectionFactory.QUEUE)
{
throw new IllegalStateException("Cannot create durable subscriber from javax.jms.QueueSession");
}
Session session = getSession();
if (trace)
log.trace("createDurableSubscriber " + session + " topic=" + topic + " name=" + name);
TopicSubscriber result = session.createDurableSubscriber(topic, name);
result = new JmsTopicSubscriber(result, this);
if (trace)
log.trace("createdDurableSubscriber " + session + " JmsTopicSubscriber=" + result);
addConsumer(result);
return result;
|
public javax.jms.TopicSubscriber | createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal)
Session session = getSession();
if (trace)
log.trace("createDurableSubscriber " + session + " topic=" + topic + " name=" + name + " selector=" + messageSelector + " noLocal=" + noLocal);
TopicSubscriber result = session.createDurableSubscriber(topic, name, messageSelector, noLocal);
result = new JmsTopicSubscriber(result, this);
if (trace)
log.trace("createdDurableSubscriber " + session + " JmsTopicSubscriber=" + result);
addConsumer(result);
return result;
|
public javax.jms.MapMessage | createMapMessage()
Session session = getSession();
if (trace)
log.trace("createMapMessage" + session);
return session.createMapMessage();
|
public javax.jms.Message | createMessage()
Session session = getSession();
if (trace)
log.trace("createMessage" + session);
return session.createMessage();
|
public javax.jms.ObjectMessage | createObjectMessage()
Session session = getSession();
if (trace)
log.trace("createObjectMessage" + session);
return session.createObjectMessage();
|
public javax.jms.ObjectMessage | createObjectMessage(java.io.Serializable object)
Session session = getSession();
if (trace)
log.trace("createObjectMessage(Object)" + session);
return session.createObjectMessage(object);
|
public javax.jms.MessageProducer | createProducer(javax.jms.Destination destination)
Session session = getSession();
if (trace)
log.trace("createProducer " + session + " dest=" + destination);
MessageProducer result = getSession().createProducer(destination);
if (trace)
log.trace("createdProducer " + session + " producer=" + result);
addProducer(result);
return result;
|
public javax.jms.TopicPublisher | createPublisher(javax.jms.Topic topic)
TopicSession session = getTopicSession();
if (trace)
log.trace("createPublisher " + session + " topic=" + topic);
TopicPublisher result = session.createPublisher(topic);
if (trace)
log.trace("createdPublisher " + session + " publisher=" + result);
addProducer(result);
return result;
|
public javax.jms.Queue | createQueue(java.lang.String queueName)
if(info.getType() == JmsConnectionFactory.TOPIC)
{
throw new IllegalStateException("Cannot create browser or javax.jms.TopicSession");
}
Session session = getSession();
if (trace)
log.trace("createQueue " + session + " queueName=" + queueName);
Queue result = session.createQueue(queueName);
if (trace)
log.trace("createdQueue " + session + " queue=" + result);
return result;
|
public javax.jms.QueueReceiver | createReceiver(javax.jms.Queue queue)
QueueSession session = getQueueSession();
if (trace)
log.trace("createReceiver " + session + " queue=" + queue);
QueueReceiver result = session.createReceiver(queue);
result = new JmsQueueReceiver(result, this);
if (trace)
log.trace("createdReceiver " + session + " receiver=" + result);
addConsumer(result);
return result;
|
public javax.jms.QueueReceiver | createReceiver(javax.jms.Queue queue, java.lang.String messageSelector)
QueueSession session = getQueueSession();
if (trace)
log.trace("createReceiver " + session + " queue=" + queue + " selector=" + messageSelector);
QueueReceiver result = session.createReceiver(queue, messageSelector);
result = new JmsQueueReceiver(result, this);
if (trace)
log.trace("createdReceiver " + session + " receiver=" + result);
addConsumer(result);
return result;
|
public javax.jms.QueueSender | createSender(javax.jms.Queue queue)
QueueSession session = getQueueSession();
if (trace)
log.trace("createSender " + session + " queue=" + queue);
QueueSender result = session.createSender(queue);
if (trace)
log.trace("createdSender " + session + " sender=" + result);
addProducer(result);
return result;
|
public javax.jms.StreamMessage | createStreamMessage()
Session session = getSession();
if (trace)
log.trace("createStreamMessage" + session);
return session.createStreamMessage();
|
public javax.jms.TopicSubscriber | createSubscriber(javax.jms.Topic topic)
TopicSession session = getTopicSession();
if (trace)
log.trace("createSubscriber " + session + " topic=" + topic);
TopicSubscriber result = session.createSubscriber(topic);
result = new JmsTopicSubscriber(result, this);
if (trace)
log.trace("createdSubscriber " + session + " JmsTopicSubscriber=" + result);
addConsumer(result);
return result;
|
public javax.jms.TopicSubscriber | createSubscriber(javax.jms.Topic topic, java.lang.String messageSelector, boolean noLocal)
TopicSession session = getTopicSession();
if (trace)
log.trace("createSubscriber " + session + " topic=" + topic + " selector=" + messageSelector + " noLocal=" + noLocal);
TopicSubscriber result = session.createSubscriber(topic, messageSelector, noLocal);
result = new JmsTopicSubscriber(result, this);
if (trace)
log.trace("createdSubscriber " + session + " JmsTopicSubscriber=" + result);
addConsumer(result);
return result;
|
public javax.jms.TemporaryQueue | createTemporaryQueue()
if(info.getType() == JmsConnectionFactory.TOPIC)
{
throw new IllegalStateException("Cannot create temporary queue for javax.jms.TopicSession");
}
Session session = getSession();
if (trace)
log.trace("createTemporaryQueue " + session);
TemporaryQueue temp = session.createTemporaryQueue();
if (trace)
log.trace("createdTemporaryQueue " + session + " temp=" + temp);
sf.addTemporaryQueue(temp);
return temp;
|
public javax.jms.TemporaryTopic | createTemporaryTopic()
if(info.getType() == JmsConnectionFactory.QUEUE)
{
throw new IllegalStateException("Cannot create temporary topic for javax.jms.QueueSession");
}
Session session = getSession();
if (trace)
log.trace("createTemporaryTopic " + session);
TemporaryTopic temp = session.createTemporaryTopic();
if (trace)
log.trace("createdTemporaryTopic " + session + " temp=" + temp);
sf.addTemporaryTopic(temp);
return temp;
|
public javax.jms.TextMessage | createTextMessage()
Session session = getSession();
if (trace)
log.trace("createTextMessage" + session);
return session.createTextMessage();
|
public javax.jms.TextMessage | createTextMessage(java.lang.String string)
Session session = getSession();
if (trace)
log.trace("createTextMessage(String)" + session);
return session.createTextMessage(string);
|
public javax.jms.Topic | createTopic(java.lang.String topicName)
if(info.getType() == JmsConnectionFactory.QUEUE)
{
throw new IllegalStateException("Cannot create topic for javax.jms.QueueSession");
}
Session session = getSession();
if (trace)
log.trace("createTopic " + session + " topicName=" + topicName);
Topic result = session.createTopic(topicName);
if (trace)
log.trace("createdTopic " + session + " topic=" + result);
return result;
|
void | destroy()
mc = null;
|
public int | getAcknowledgeMode()
getSession(); // check closed
return info.getAcknowledgeMode();
|
public javax.jms.MessageListener | getMessageListener()Always throws an Exception.
throw new IllegalStateException("Method not allowed");
|
javax.jms.QueueSession | getQueueSession()
Session s = getSession();
if( !(s instanceof QueueSession) )
throw new InvalidDestinationException("Attempting to use QueueSession methods on: "+this);
return (QueueSession) s;
|
javax.jms.Session | getSession()Ensure that the session is opened.
// ensure that the connection is opened
if (mc == null)
throw new IllegalStateException("The session is closed");
Session session = mc.getSession();
if (trace)
log.trace("getSession " + session + " for " + this);
return session;
|
javax.jms.TopicSession | getTopicSession()
Session s = getSession();
if( !(s instanceof TopicSession) )
throw new InvalidDestinationException("Attempting to use TopicSession methods on: "+this);
return (TopicSession) s;
|
public boolean | getTransacted()
getSession(); // check closed
return info.isTransacted();
|
public void | recover()
Session session = getSession();
if (info.isTransacted())
throw new IllegalStateException("Session is transacted");
if (trace)
log.trace("Recover session " + this);
session.recover();
|
void | removeConsumer(javax.jms.MessageConsumer consumer)
synchronized (consumers)
{
consumers.remove(consumer);
}
|
void | removeProducer(javax.jms.MessageProducer producer)
synchronized (producers)
{
producers.remove(producer);
}
|
public void | rollback()
Session session = getSession();
if (info.isTransacted() == false)
throw new IllegalStateException("Session is not transacted");
if (trace)
log.trace("Rollback session " + this);
session.rollback();
|
public void | run()Always throws an Error.
// should this really throw an Error?
throw new Error("Method not allowed");
|
public void | setJmsSessionFactory(JmsSessionFactory sf)
this.sf = sf;
|
void | setManagedConnection(JmsManagedConnection mc)
if (this.mc != null)
this.mc.removeHandle(this);
this.mc = mc;
|
public void | setMessageListener(javax.jms.MessageListener listener)Always throws an Exception.
throw new IllegalStateException("Method not allowed");
|
void | start()
if (mc != null)
mc.start();
|
void | stop()
if (mc != null)
mc.stop();
|
public void | unsubscribe(java.lang.String name)
if(info.getType() == JmsConnectionFactory.QUEUE)
{
throw new IllegalStateException("Cannot unsubscribe for javax.jms.QueueSession");
}
Session session = getSession();
if (trace)
log.trace("unsubscribe " + session + " name=" + name);
session.unsubscribe(name);
|