public class JmsSession extends java.lang.Object implements XASession, ThreadTask, XAResource
| Modifier and Type | Field and Description |
|---|---|
protected static L10N |
L |
protected static java.util.logging.Logger |
log |
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTEDTMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY| Constructor and Description |
|---|
JmsSession(ConnectionImpl connection,
boolean isTransacted,
int ackMode,
boolean isXA) |
| Modifier and Type | Method and Description |
|---|---|
void |
acknowledge()
Acknowledge received
|
void |
acquireListenSemaphore() |
protected void |
addConsumer(MessageConsumerImpl consumer) |
void |
checkOpen()
Checks that the session is open.
|
void |
close()
Closes the session
|
void |
commit()
Commits the messages.
|
void |
commit(Xid xid,
boolean onePhase)
Called to commit.
|
QueueBrowser |
createBrowser(Queue queue)
Creates a QueueBrowser to browse messages in the queue.
|
QueueBrowser |
createBrowser(Queue queue,
java.lang.String messageSelector)
Creates a QueueBrowser to browse messages in the queue.
|
BytesMessage |
createBytesMessage()
Creates a new byte[] message.
|
MessageConsumer |
createConsumer(Destination destination)
Creates a consumer to receive messages.
|
MessageConsumer |
createConsumer(Destination destination,
java.lang.String messageSelector)
Creates a consumer to receive messages.
|
MessageConsumer |
createConsumer(Destination destination,
java.lang.String messageSelector,
boolean noLocal)
Creates a consumer to receive messages.
|
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name)
Creates a durable subscriber to receive messages.
|
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name,
java.lang.String messageSelector,
boolean noLocal)
Creates a subscriber to receive messages.
|
MapMessage |
createMapMessage()
Creates a new map message.
|
Message |
createMessage()
Creates a message.
|
ObjectMessage |
createObjectMessage()
Creates an object message.
|
ObjectMessage |
createObjectMessage(java.io.Serializable obj)
Creates an object message.
|
MessageProducer |
createProducer(Destination destination)
Creates a producer to produce messages.
|
Queue |
createQueue(java.lang.String queueName)
Creates a new queue.
|
StreamMessage |
createStreamMessage()
Creates a stream message.
|
TemporaryQueue |
createTemporaryQueue()
Creates a temporary queue.
|
TemporaryTopic |
createTemporaryTopic()
Creates a temporary topic.
|
TextMessage |
createTextMessage()
Creates a text message.
|
TextMessage |
createTextMessage(java.lang.String message)
Creates a text message.
|
Topic |
createTopic(java.lang.String topicName)
Creates a new topic.
|
void |
end(Xid xid,
int flags)
Called when the resource is is done with a transaction.
|
void |
forget(Xid xid)
Called to forget an Xid that had a heuristic commit.
|
int |
getAcknowledgeMode()
Returns the acknowledge mode for the session.
|
java.lang.String |
getClientID()
Returns the connection's clientID
|
MessageListener |
getMessageListener()
Returns the message listener
|
java.lang.String |
getPublisherId() |
Session |
getSession() |
boolean |
getTransacted()
Returns true if the session is in a transaction.
|
int |
getTransactionTimeout()
Gets the transaction timeout in seconds.
|
XAResource |
getXAResource() |
boolean |
isActive()
Returns true if the connection is active.
|
boolean |
isClosed() |
boolean |
isSameRM(XAResource xa)
Returns true if the specified resource has the same RM.
|
int |
prepare(Xid xid)
Called to start the first phase of the commit.
|
void |
recover()
Recovers the messages.
|
Xid[] |
recover(int flag)
Called to find Xid's that need recovery.
|
void |
releaseListenSemaphore() |
protected void |
removeConsumer(MessageConsumerImpl consumer) |
void |
rollback()
Rollsback the messages.
|
void |
rollback(Xid xid)
Called to roll back.
|
void |
rollbackImpl()
Rollsback the messages.
|
void |
run()
Called to synchronously receive messages
|
void |
send(AbstractDestination queue,
Message appMessage,
int deliveryMode,
int priority,
long timeout)
Adds a message to the session message queue.
|
void |
setMessageListener(MessageListener listener)
Sets the message listener
|
boolean |
setTransactionTimeout(int timeout)
Sets the transaction timeout in seconds.
|
void |
start(Xid xid,
int flags)
Called when the resource is associated with a transaction.
|
java.lang.String |
toString() |
void |
unsubscribe(java.lang.String name)
Unsubscribe from a durable subscription.
|
protected static final java.util.logging.Logger log
protected static final L10N L
public JmsSession(ConnectionImpl connection, boolean isTransacted, int ackMode, boolean isXA) throws JMSException
JMSExceptionpublic java.lang.String getClientID()
throws JMSException
JMSExceptionpublic java.lang.String getPublisherId()
public boolean isActive()
public boolean getTransacted()
throws JMSException
getTransacted in interface SessiongetTransacted in interface XASessionJMSExceptionpublic int getAcknowledgeMode()
throws JMSException
getAcknowledgeMode in interface SessionJMSExceptionpublic MessageListener getMessageListener() throws JMSException
getMessageListener in interface SessionJMSExceptionpublic void setMessageListener(MessageListener listener) throws JMSException
setMessageListener in interface SessionJMSExceptionpublic BytesMessage createBytesMessage() throws JMSException
createBytesMessage in interface SessionJMSExceptionpublic MapMessage createMapMessage() throws JMSException
createMapMessage in interface SessionJMSExceptionpublic Message createMessage() throws JMSException
createMessage in interface SessionJMSExceptionpublic ObjectMessage createObjectMessage() throws JMSException
createObjectMessage in interface SessionJMSExceptionpublic ObjectMessage createObjectMessage(java.io.Serializable obj) throws JMSException
createObjectMessage in interface Sessionobj - a serializable message.JMSExceptionpublic StreamMessage createStreamMessage() throws JMSException
createStreamMessage in interface SessionJMSExceptionpublic TextMessage createTextMessage() throws JMSException
createTextMessage in interface SessionJMSExceptionpublic TextMessage createTextMessage(java.lang.String message) throws JMSException
createTextMessage in interface SessionJMSExceptionpublic MessageConsumer createConsumer(Destination destination) throws JMSException
createConsumer in interface Sessiondestination - the destination to receive messages from.JMSExceptionpublic MessageConsumer createConsumer(Destination destination, java.lang.String messageSelector) throws JMSException
createConsumer in interface Sessiondestination - the destination to receive messages from.messageSelector - query to restrict the messages.JMSExceptionpublic MessageConsumer createConsumer(Destination destination, java.lang.String messageSelector, boolean noLocal) throws JMSException
createConsumer in interface Sessiondestination - the destination to receive messages from.messageSelector - query to restrict the messages.JMSExceptionpublic MessageProducer createProducer(Destination destination) throws JMSException
createProducer in interface Sessiondestination - the destination to send messages from.JMSExceptionpublic QueueBrowser createBrowser(Queue queue) throws JMSException
createBrowser in interface Sessionqueue - the queue to send messages to.JMSExceptionpublic QueueBrowser createBrowser(Queue queue, java.lang.String messageSelector) throws JMSException
createBrowser in interface Sessionqueue - the queue to send messages to.JMSExceptionpublic Queue createQueue(java.lang.String queueName) throws JMSException
createQueue in interface SessionJMSExceptionpublic TemporaryQueue createTemporaryQueue() throws JMSException
createTemporaryQueue in interface SessionJMSExceptionpublic Topic createTopic(java.lang.String topicName) throws JMSException
createTopic in interface SessionJMSExceptionpublic TemporaryTopic createTemporaryTopic() throws JMSException
createTemporaryTopic in interface SessionJMSExceptionpublic TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name) throws JMSException
createDurableSubscriber in interface Sessiontopic - the topic to receive messages from.JMSExceptionpublic TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws JMSException
createDurableSubscriber in interface Sessiontopic - the topic to receive messages from.messageSelector - topic to restrict the messages.noLocal - if true, don't receive messages we've sentJMSExceptionpublic void unsubscribe(java.lang.String name)
throws JMSException
unsubscribe in interface SessionJMSExceptionpublic void commit()
throws JMSException
commit in interface Sessioncommit in interface XASessionJMSExceptionpublic void acknowledge()
throws JMSException
JMSExceptionpublic void recover()
throws JMSException
recover in interface SessionJMSExceptionpublic void rollback()
throws JMSException
rollback in interface Sessionrollback in interface XASessionJMSExceptionpublic void rollbackImpl()
throws JMSException
JMSExceptionpublic void close()
throws JMSException
close in interface SessionJMSExceptionprotected void addConsumer(MessageConsumerImpl consumer)
protected void removeConsumer(MessageConsumerImpl consumer)
public void send(AbstractDestination queue, Message appMessage, int deliveryMode, int priority, long timeout) throws JMSException
JMSExceptionpublic Session getSession()
getSession in interface XASessionpublic XAResource getXAResource()
getXAResource in interface XASessionpublic boolean isSameRM(XAResource xa) throws XAException
isSameRM in interface XAResourceXAExceptionpublic boolean setTransactionTimeout(int timeout)
throws XAException
setTransactionTimeout in interface XAResourceXAExceptionpublic int getTransactionTimeout()
throws XAException
getTransactionTimeout in interface XAResourceXAExceptionpublic void start(Xid xid, int flags) throws XAException
start in interface XAResourceXAExceptionpublic void end(Xid xid, int flags) throws XAException
end in interface XAResourceXAExceptionpublic int prepare(Xid xid) throws XAException
prepare in interface XAResourceXAExceptionpublic void commit(Xid xid, boolean onePhase) throws XAException
commit in interface XAResourceXAExceptionpublic void rollback(Xid xid) throws XAException
rollback in interface XAResourceXAExceptionpublic void forget(Xid xid) throws XAException
forget in interface XAResourceXAExceptionpublic Xid[] recover(int flag) throws XAException
recover in interface XAResourceXAExceptionpublic void acquireListenSemaphore()
public void releaseListenSemaphore()
public void run()
run in interface ThreadTaskrun in interface java.lang.Runnablerun in interface Sessionpublic boolean isClosed()
public void checkOpen()
throws IllegalStateException
IllegalStateExceptionpublic java.lang.String toString()
toString in class java.lang.Object