Methods Summary |
---|
public void | addTemporaryQueue(javax.jms.TemporaryQueue temp)
synchronized(tempQueues)
{
tempQueues.add(temp);
}
|
public void | addTemporaryTopic(javax.jms.TemporaryTopic temp)
synchronized(tempTopics)
{
tempTopics.add(temp);
}
|
protected JmsSession | allocateConnection(boolean transacted, int acknowledgeMode, int sessionType)
try
{
synchronized (sessions)
{
if (mcf.isStrict() && sessions.isEmpty() == false)
throw new IllegalStateException("Only allowed one session per connection. See the J2EE spec, e.g. J2EE1.4 Section 6.6");
if (transacted)
acknowledgeMode = Session.SESSION_TRANSACTED;
JmsConnectionRequestInfo info = new JmsConnectionRequestInfo(transacted, acknowledgeMode, sessionType);
info.setUserName(userName);
info.setPassword(password);
info.setClientID(clientID);
if (trace)
log.trace("Allocating session for " + this + " with request info=" + info);
JmsSession session = (JmsSession) cm.allocateConnection(mcf, info);
if (trace)
log.trace("Allocated " + this + " session=" + session);
session.setJmsSessionFactory(this);
if (started)
session.start();
sessions.add(session);
return session;
}
}
catch (ResourceException e)
{
log.error("could not create session", e);
JMSException je = new JMSException
("Could not create a session: " + e);
je.setLinkedException(e);
throw je;
}
|
protected void | checkClosed()
if (closed)
throw new IllegalStateException("The connection is closed");
|
public void | close()
if (closed)
return;
closed = true;
if (trace)
log.trace("close() " + this);
synchronized (sessions)
{
for (Iterator i = sessions.iterator(); i.hasNext();)
{
JmsSession session = (JmsSession) i.next();
try
{
session.closeSession();
}
catch (Throwable t)
{
log.trace("Error closing session", t);
}
i.remove();
}
}
synchronized (tempQueues)
{
for (Iterator i = tempQueues.iterator(); i.hasNext();)
{
TemporaryQueue temp = (TemporaryQueue) i.next();
try
{
if (trace)
log.trace("Closing temporary queue " + temp + " for " + this);
temp.delete();
}
catch (Throwable t)
{
log.trace("Error deleting temporary queue", t);
}
i.remove();
}
}
synchronized (tempTopics)
{
for (Iterator i = tempTopics.iterator(); i.hasNext();)
{
TemporaryTopic temp = (TemporaryTopic) i.next();
try
{
if (trace)
log.trace("Closing temporary topic " + temp + " for " + this);
temp.delete();
}
catch (Throwable t)
{
log.trace("Error deleting temporary queue", t);
}
i.remove();
}
}
|
public void | closeSession(JmsSession session)
synchronized (sessions)
{
sessions.remove(session);
}
|
public javax.jms.ConnectionConsumer | createConnectionConsumer(javax.jms.Destination destination, javax.jms.ServerSessionPool pool, int maxMessages)
throw new IllegalStateException(ISE);
|
public javax.jms.ConnectionConsumer | createConnectionConsumer(javax.jms.Destination destination, java.lang.String name, javax.jms.ServerSessionPool pool, int maxMessages)
throw new IllegalStateException(ISE);
|
public javax.jms.ConnectionConsumer | createConnectionConsumer(javax.jms.Queue queue, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
throw new IllegalStateException(ISE);
|
public javax.jms.ConnectionConsumer | createConnectionConsumer(javax.jms.Topic topic, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
throw new IllegalStateException(ISE);
|
public javax.jms.ConnectionConsumer | createDurableConnectionConsumer(javax.jms.Topic topic, java.lang.String subscriptionName, java.lang.String messageSelector, javax.jms.ServerSessionPool sessionPool, int maxMessages)
throw new IllegalStateException(ISE);
|
public javax.jms.QueueSession | createQueueSession(boolean transacted, int acknowledgeMode)
checkClosed();
if (type == JmsConnectionFactory.TOPIC)
throw new IllegalStateException("Can not get a queue session from a topic connection");
return allocateConnection(transacted, acknowledgeMode, type);
|
public javax.jms.Session | createSession(boolean transacted, int acknowledgeMode)
checkClosed();
return allocateConnection(transacted, acknowledgeMode, type);
|
public javax.jms.TopicSession | createTopicSession(boolean transacted, int acknowledgeMode)
checkClosed();
if (type == JmsConnectionFactory.QUEUE)
throw new IllegalStateException("Can not get a topic session from a queue connection");
return allocateConnection(transacted, acknowledgeMode, type);
|
public java.lang.String | getClientID()
checkClosed();
return clientID;
|
public javax.jms.ExceptionListener | getExceptionListener()
throw new IllegalStateException(ISE);
|
public javax.jms.ConnectionMetaData | getMetaData()
checkClosed();
return mcf.getMetaData();
|
public javax.naming.Reference | getReference()
return reference;
|
public void | setClientID(java.lang.String cID)
if (mcf.isStrict())
throw new IllegalStateException(ISE);
checkClosed();
if (clientID != null)
throw new IllegalStateException("Cannot change client id");
clientID = cID;
|
public void | setExceptionListener(javax.jms.ExceptionListener listener)
throw new IllegalStateException(ISE);
|
public void | setPassword(java.lang.String password)
this.password = password;
|
public void | setReference(javax.naming.Reference reference)
this.reference = reference;
|
public void | setUserName(java.lang.String name)
userName = name;
|
public void | start()
checkClosed();
if (trace)
log.trace("start() " + this);
synchronized (sessions)
{
if (started)
return;
started = true;
for (Iterator i = sessions.iterator(); i.hasNext();)
{
JmsSession session = (JmsSession) i.next();
session.start();
}
}
|
public void | stop()
if (mcf.isStrict())
throw new IllegalStateException(ISE);
checkClosed();
if (trace)
log.trace("stop() " + this);
synchronized (sessions)
{
if (started == false)
return;
started = true;
for (Iterator i = sessions.iterator(); i.hasNext();)
{
JmsSession session = (JmsSession) i.next();
session.stop();
}
}
|