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_TRANSACTED
TMENDRSCAN, 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
JMSException
public java.lang.String getClientID() throws JMSException
JMSException
public java.lang.String getPublisherId()
public boolean isActive()
public boolean getTransacted() throws JMSException
getTransacted
in interface Session
getTransacted
in interface XASession
JMSException
public int getAcknowledgeMode() throws JMSException
getAcknowledgeMode
in interface Session
JMSException
public MessageListener getMessageListener() throws JMSException
getMessageListener
in interface Session
JMSException
public void setMessageListener(MessageListener listener) throws JMSException
setMessageListener
in interface Session
JMSException
public BytesMessage createBytesMessage() throws JMSException
createBytesMessage
in interface Session
JMSException
public MapMessage createMapMessage() throws JMSException
createMapMessage
in interface Session
JMSException
public Message createMessage() throws JMSException
createMessage
in interface Session
JMSException
public ObjectMessage createObjectMessage() throws JMSException
createObjectMessage
in interface Session
JMSException
public ObjectMessage createObjectMessage(java.io.Serializable obj) throws JMSException
createObjectMessage
in interface Session
obj
- a serializable message.JMSException
public StreamMessage createStreamMessage() throws JMSException
createStreamMessage
in interface Session
JMSException
public TextMessage createTextMessage() throws JMSException
createTextMessage
in interface Session
JMSException
public TextMessage createTextMessage(java.lang.String message) throws JMSException
createTextMessage
in interface Session
JMSException
public MessageConsumer createConsumer(Destination destination) throws JMSException
createConsumer
in interface Session
destination
- the destination to receive messages from.JMSException
public MessageConsumer createConsumer(Destination destination, java.lang.String messageSelector) throws JMSException
createConsumer
in interface Session
destination
- the destination to receive messages from.messageSelector
- query to restrict the messages.JMSException
public MessageConsumer createConsumer(Destination destination, java.lang.String messageSelector, boolean noLocal) throws JMSException
createConsumer
in interface Session
destination
- the destination to receive messages from.messageSelector
- query to restrict the messages.JMSException
public MessageProducer createProducer(Destination destination) throws JMSException
createProducer
in interface Session
destination
- the destination to send messages from.JMSException
public QueueBrowser createBrowser(Queue queue) throws JMSException
createBrowser
in interface Session
queue
- the queue to send messages to.JMSException
public QueueBrowser createBrowser(Queue queue, java.lang.String messageSelector) throws JMSException
createBrowser
in interface Session
queue
- the queue to send messages to.JMSException
public Queue createQueue(java.lang.String queueName) throws JMSException
createQueue
in interface Session
JMSException
public TemporaryQueue createTemporaryQueue() throws JMSException
createTemporaryQueue
in interface Session
JMSException
public Topic createTopic(java.lang.String topicName) throws JMSException
createTopic
in interface Session
JMSException
public TemporaryTopic createTemporaryTopic() throws JMSException
createTemporaryTopic
in interface Session
JMSException
public TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name) throws JMSException
createDurableSubscriber
in interface Session
topic
- the topic to receive messages from.JMSException
public TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws JMSException
createDurableSubscriber
in interface Session
topic
- the topic to receive messages from.messageSelector
- topic to restrict the messages.noLocal
- if true, don't receive messages we've sentJMSException
public void unsubscribe(java.lang.String name) throws JMSException
unsubscribe
in interface Session
JMSException
public void commit() throws JMSException
commit
in interface Session
commit
in interface XASession
JMSException
public void acknowledge() throws JMSException
JMSException
public void recover() throws JMSException
recover
in interface Session
JMSException
public void rollback() throws JMSException
rollback
in interface Session
rollback
in interface XASession
JMSException
public void rollbackImpl() throws JMSException
JMSException
public void close() throws JMSException
close
in interface Session
JMSException
protected void addConsumer(MessageConsumerImpl consumer)
protected void removeConsumer(MessageConsumerImpl consumer)
public void send(AbstractDestination queue, Message appMessage, int deliveryMode, int priority, long timeout) throws JMSException
JMSException
public Session getSession()
getSession
in interface XASession
public XAResource getXAResource()
getXAResource
in interface XASession
public boolean isSameRM(XAResource xa) throws XAException
isSameRM
in interface XAResource
XAException
public boolean setTransactionTimeout(int timeout) throws XAException
setTransactionTimeout
in interface XAResource
XAException
public int getTransactionTimeout() throws XAException
getTransactionTimeout
in interface XAResource
XAException
public void start(Xid xid, int flags) throws XAException
start
in interface XAResource
XAException
public void end(Xid xid, int flags) throws XAException
end
in interface XAResource
XAException
public int prepare(Xid xid) throws XAException
prepare
in interface XAResource
XAException
public void commit(Xid xid, boolean onePhase) throws XAException
commit
in interface XAResource
XAException
public void rollback(Xid xid) throws XAException
rollback
in interface XAResource
XAException
public void forget(Xid xid) throws XAException
forget
in interface XAResource
XAException
public Xid[] recover(int flag) throws XAException
recover
in interface XAResource
XAException
public void acquireListenSemaphore()
public void releaseListenSemaphore()
public void run()
run
in interface ThreadTask
run
in interface java.lang.Runnable
run
in interface Session
public boolean isClosed()
public void checkOpen() throws IllegalStateException
IllegalStateException
public java.lang.String toString()
toString
in class java.lang.Object