|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.jms.Session
public class Session
Implements the javax.jms.Session
interface.
A Session object is a single-threaded context for producing and consuming messages. A session serves several purposes:
Nested Class Summary | |
---|---|
(package private) class |
Session.Closer
This class synchronizes the close. |
private static class |
Session.MessageListenerContext
Context used to associate a message consumer with a set of messages to consume. |
private static class |
Session.RequestStatus
The status of the current request. |
private class |
Session.SessionCloseTask
The SessionCloseTask class is used by non-XA transacted
sessions for taking care of closing them if they tend to be pending,
and if a transaction timer has been set. |
private class |
Session.SessionDaemon
This thread controls the session in mode LISTENER. |
private static class |
Session.SessionMode
The way the session is used. |
private static class |
Session.Status
Status of the session |
Field Summary | |
---|---|
private int |
acknowledgeMode
The acknowledgement mode of the session. |
private boolean |
asyncSend
Indicates whether the messages produced are asynchronously sent or not (without or with acknowledgment). |
private boolean |
asyncSub
Indicates whether the subscription requests are asynchronously handled or not. |
private boolean |
autoAck
true if the session's acknowledgements are automatic. |
private java.util.Vector |
browsers
Vector of queue browsers. |
private Session.Closer |
closer
Used to synchronize the method close() |
private Session.SessionCloseTask |
closingTask
Task for closing the session if it becomes pending. |
private Connection |
cnx
The connection the session belongs to. |
private java.util.Vector |
consumers
Vector of message consumers. |
private Session.SessionDaemon |
daemon
Daemon distributing asynchronous server deliveries. |
(package private) java.util.Hashtable |
deliveries
Table holding the identifiers of the messages delivered per destination or subscription, and not acknowledged. |
private java.lang.String |
ident
The identifier of the session. |
private boolean |
implicitAck
Indicates whether the messages consumed are implicitly acknowledged or not. |
private java.util.List |
inInterceptors
|
private int |
listenerCount
Counter of message listeners. |
static org.objectweb.util.monolog.api.Logger |
logger
|
private MessageConsumerListener |
messageConsumerListener
|
protected javax.jms.MessageListener |
messageListener
The message listener of the session, if any. |
private RequestMultiplexer |
mtpx
The request multiplexer used to communicate with the user proxy. |
private java.util.List |
outInterceptors
|
private MessageConsumer |
pendingMessageConsumer
The message consumer currently making a request (null if none). |
private java.util.Vector |
producers
Vector of message producers. |
private int |
queueMessageReadMax
Maximum number of messages that can be read at once from a queue. |
private Requestor |
receiveRequestor
The requestor used by the session to make 'receive' with the user proxy. |
private boolean |
recover
Indicates that the session has been recovered by a message listener. |
private Queue |
repliesIn
FIFO queue holding the asynchronous server deliveries. |
private Requestor |
requestor
The requestor used by the session to communicate with the user proxy. |
private int |
requestStatus
Status of the request: NONE, RUN, DONE. |
private boolean |
scheduled
true if the session's transaction is scheduled. |
(package private) java.util.Hashtable |
sendings
Table holding the ProducerMessages holding producers'
messages and destinated to be sent at commit. |
private int |
sessionMode
Mode of the session: NONE, RECEIVE, LISTENER, APP_SERVER |
private java.lang.Thread |
singleThreadOfControl
The current active control thread. |
private int |
status
Status of the session: STOP, START, CLOSE |
private int |
topicAckBufferMax
Maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode. |
private int |
topicActivationThreshold
This threshold is the minimum messages number below which the subscription is activated. |
private int |
topicPassivationThreshold
This threshold is the maximum messages number over which the subscription is passivated. |
(package private) boolean |
transacted
true if the session is transacted. |
Fields inherited from interface javax.jms.Session |
---|
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
Constructor Summary | |
---|---|
Session(Connection cnx,
boolean transacted,
int acknowledgeMode,
RequestMultiplexer mtpx)
Opens a session. |
Method Summary | |
---|---|
(package private) void |
acknowledge()
Method acknowledging the received messages. |
protected void |
addConsumer(MessageConsumer mc)
Called here and by sub-classes. |
(package private) MessageConsumerListener |
addMessageListener(MessageConsumerListener mcl)
Called by MessageConsumer |
protected void |
addProducer(MessageProducer mp)
Called here and by sub-classes. |
protected void |
checkClosed()
Checks if the session is closed. |
(package private) void |
checkConsumers(java.lang.String agentId)
Called by Connection (i.e. temporary destinations deletion) |
private void |
checkSessionMode(int expectedSessionMode)
Checks the session mode. |
private void |
checkThreadOfControl()
Checks if the calling thread is the thread of control. |
void |
close()
Closes the session. |
(package private) void |
closeBrowser(QueueBrowser qb)
Called by Queue browser. |
(package private) void |
closeConsumer(MessageConsumer mc)
Called by MessageConsumer. |
(package private) void |
closeProducer(MessageProducer mp)
Called by MessageProducer. |
void |
commit()
API method. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue)
Creates a QueueBrowser object to peek at the messages on the specified queue. |
javax.jms.QueueBrowser |
createBrowser(javax.jms.Queue queue,
java.lang.String selector)
Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector. |
javax.jms.BytesMessage |
createBytesMessage()
Creates a BytesMessage object. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest)
Creates a MessageConsumer for the specified destination. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest,
java.lang.String selector)
Creates a MessageConsumer for the specified destination using a message selector. |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Destination dest,
java.lang.String selector,
boolean noLocal)
Creates a MessageConsumer for the specified destination using a message selector. |
private java.lang.String |
createDestination(byte type,
java.lang.String name)
Create a destination with the given name and type. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name)
Creates or retrieves a durable subscription with the specified name. |
javax.jms.TopicSubscriber |
createDurableSubscriber(javax.jms.Topic topic,
java.lang.String name,
java.lang.String selector,
boolean noLocal)
Creates or retrieves a durable subscription with the specified name. |
javax.jms.MapMessage |
createMapMessage()
Creates a MapMessage object. |
javax.jms.Message |
createMessage()
Creates a Message object. |
javax.jms.ObjectMessage |
createObjectMessage()
Creates a ObjectMessage object. |
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable obj)
Creates a ObjectMessage object. |
javax.jms.MessageProducer |
createProducer(javax.jms.Destination dest)
Creates a MessageProducer to send messages to the specified destination. |
javax.jms.Queue |
createQueue(java.lang.String name)
This method allows to create or retrieve a Queue with the given name on the local server. |
javax.jms.StreamMessage |
createStreamMessage()
Creates a StreamMessage object. |
javax.jms.TemporaryQueue |
createTemporaryQueue()
API method. |
javax.jms.TemporaryTopic |
createTemporaryTopic()
API method. |
javax.jms.TextMessage |
createTextMessage()
Creates a TextMessage object. |
javax.jms.TextMessage |
createTextMessage(java.lang.String text)
Creates a TextMessage object with the specified text. |
javax.jms.Topic |
createTopic(java.lang.String name)
This method allows to create or retrieve a Topic with the given name on the local server. |
private void |
deny()
Method denying the received messages. |
private void |
denyMessage(java.lang.String targetName,
java.lang.String msgId,
boolean queueMode)
Called by: - method run (application server thread) synchronized - method onMessage (SessionDaemon thread) not synchronized but no concurrent call except a close which first stops SessionDaemon. |
private void |
doAcknowledge()
Method acknowledging the received messages. |
(package private) void |
doClose()
|
private void |
doRecover()
|
private void |
doStart()
|
private void |
doStop()
|
(package private) int |
getAckMode()
|
int |
getAcknowledgeMode()
API method. |
(package private) Connection |
getConnection()
|
(package private) java.lang.String |
getId()
|
javax.jms.MessageListener |
getMessageListener()
API method. |
int |
getQueueMessageReadMax()
Get the maximum number of messages that can be read at once from a queue for this Session. |
(package private) RequestMultiplexer |
getRequestMultiplexer()
|
int |
getTopicAckBufferMax()
Get the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this session. |
int |
getTopicActivationThreshold()
Get the threshold of activation for this session. |
int |
getTopicPassivationThreshold()
Get the threshold of passivation for this session. |
boolean |
getTransacted()
API method. |
boolean |
isAsyncSend()
Indicates whether the messages produced are asynchronously sent or not (without or with acknowledgment). |
boolean |
isAsyncSub()
Indicates whether the subscription request is asynchronously handled or not. |
boolean |
isAutoAck()
|
boolean |
isImplicitAck()
Indicates whether the messages consumed are implicitly acknowledged or not. |
(package private) boolean |
isStarted()
|
(package private) void |
onMessage(Message msg)
Called by ConnectionConsumer in order to distribute a message through the method run(). |
(package private) void |
onMessage(Message momMsg,
MessageConsumerListener mcl)
Called by onMessages() |
private void |
onMessages(Session.MessageListenerContext ctx)
Called by SessionDaemon. |
private void |
postReceive()
Final stage after calling the reply has been returned by the roxy. |
private void |
prepareAck(java.lang.String name,
java.lang.String id,
boolean queueMode)
Method called by message consumers when receiving a message for preparing the session to later acknowledge or deny it. |
private void |
prepareSend(Destination dest,
Message msg)
Method called by message producers when producing a message for preparing the session to later commit it. |
private void |
preReceive(MessageConsumer mc)
First stage before calling the proxy and waiting for the reply. |
(package private) void |
pushMessages(SingleSessionConsumer consumerListener,
ConsumerMessages messages)
Called by MessageConsumerListener (demultiplexer thread from RequestMultiplexer) in order to distribute messages to a message consumer. |
(package private) javax.jms.Message |
receive(long requestTimeToLive,
long waitTimeOut,
MessageConsumer mc,
java.lang.String targetName,
java.lang.String selector,
boolean queueMode)
Called by MessageConsumer. |
void |
recover()
API method. |
(package private) void |
removeMessageListener(MessageConsumerListener mcl,
boolean check)
Called by MessageConsumer. |
void |
rollback()
API method. |
void |
run()
API method. |
(package private) void |
send(Destination dest,
javax.jms.Message msg,
int deliveryMode,
int priority,
long timeToLive,
boolean timestampDisabled)
Called by MessageProducer. |
void |
setAsyncSend(boolean asyncSend)
Sets asynchronously sending for this session. |
void |
setAsyncSub(boolean asyncSub)
Sets asynchronous subscription for this session. |
void |
setImplicitAck(boolean implicitAck)
Sets implicit acknowledge for this session. |
void |
setInMessageInterceptors(java.util.List pInInterceptors)
Sets the list of IN message interceptors. |
(package private) void |
setMessageConsumerListener(MessageConsumerListener mcl)
Called by MultiSessionConsumer ASF mode |
void |
setMessageListener(javax.jms.MessageListener messageListener)
API method. |
void |
setOutMessageInterceptors(java.util.List pOutInterceptors)
Sets the OUT message interceptor. |
void |
setQueueMessageReadMax(int queueMessageReadMax)
Set the maximum number of messages that can be read at once from a queue for this Session. |
private void |
setRequestStatus(int requestStatus)
Sets the request status. |
private void |
setSessionMode(int sessionMode)
Sets the session mode. |
private void |
setStatus(int status)
Sets the status of the session. |
void |
setTopicAckBufferMax(int topicAckBufferMax)
Set the maximum number of acknowledgements that can be buffered when using Session.DUPS_OK_ACKNOWLEDGE mode for this session. |
void |
setTopicActivationThreshold(int topicActivationThreshold)
Set the threshold of activation for this session. |
void |
setTopicPassivationThreshold(int topicPassivationThreshold)
Set the threshold of passivation for this session. |
void |
setTransacted(boolean t)
set transacted. |
(package private) void |
start()
Starts the asynchronous deliveries in the session. |
(package private) void |
stop()
Stops the asynchronous deliveries processing in the session. |
(package private) AbstractJmsReply |
syncRequest(AbstractJmsRequest request)
Called by MessageConsumer. |
java.lang.String |
toString()
Returns a String image of this session. |
void |
unsubscribe(java.lang.String name)
API method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static org.objectweb.util.monolog.api.Logger logger
private Session.SessionCloseTask closingTask
private boolean scheduled
true
if the session's transaction is scheduled.
protected javax.jms.MessageListener messageListener
private java.lang.String ident
private Connection cnx
boolean transacted
true
if the session is transacted.
private int acknowledgeMode
private boolean autoAck
true
if the session's acknowledgements are automatic.
private java.util.Vector consumers
private java.util.Vector producers
private java.util.Vector browsers
private Queue repliesIn
private Session.SessionDaemon daemon
private int listenerCount
java.util.Hashtable sendings
ProducerMessages
holding producers'
messages and destinated to be sent at commit.
Key: destination name
Object: ProducerMessages
java.util.Hashtable deliveries
Key: destination or subscription name
Object: MessageAcks
instance
private RequestMultiplexer mtpx
private Requestor requestor
private Requestor receiveRequestor
private boolean recover
private int status
private int sessionMode
private int requestStatus
private MessageConsumer pendingMessageConsumer
private java.lang.Thread singleThreadOfControl
private Session.Closer closer
private boolean implicitAck
FactoryParameters.implicitAck
private boolean asyncSend
FactoryParameters.asyncSend
private int queueMessageReadMax
This attribute is inherited from Connection at initialization.
FactoryParameters.queueMessageReadMax
private int topicAckBufferMax
This attribute is inherited from Connection at initialization.
FactoryParameters.topicAckBufferMax
private int topicPassivationThreshold
This attribute is inherited from Connection at initialization, default value is Integer.MAX_VALUE.
FactoryParameters.topicPassivationThreshold
private int topicActivationThreshold
This attribute is inherited from Connection at initialization, default value is 0.
FactoryParameters.topicActivationThreshold
private boolean asyncSub
Default value is false, the subscription is handled synchronously so the topic must be accessible.
private MessageConsumerListener messageConsumerListener
private java.util.List inInterceptors
private java.util.List outInterceptors
Constructor Detail |
---|
Session(Connection cnx, boolean transacted, int acknowledgeMode, RequestMultiplexer mtpx) throws javax.jms.JMSException
cnx
- The connection the session belongs to.transacted
- true
for a transacted session.acknowledgeMode
- 1 (auto), 2 (client) or 3 (dups ok).
javax.jms.JMSException
- In case of an invalid acknowledge mode.Method Detail |
---|
public boolean isImplicitAck()
This attribute is inherited from Connection at initialization, by default false.
implicitAck
public void setImplicitAck(boolean implicitAck)
Determines whether the messages produced are implicitly acknowledged or not. If set to true the messages are immediately removed from queue when delivered.
This attribute is inherited from Connection at initialization, by default false.
implicitAck
- if true sets implicit acknowledge for this session.implicitAck
public boolean isAsyncSend()
This attribute is inherited from Connection at initialization, by default false.
asyncSend
public void setAsyncSend(boolean asyncSend)
Determines whether the messages produced are asynchronously sent or not (without or with acknowledgement).
This attribute is inherited from Connection at initialization, by default false.
asyncSend
- if true sets asynchronous sending for this session.asyncSend
public final int getQueueMessageReadMax()
This attribute is inherited from Connection at initialization, default value is 1.
queueMessageReadMax
public void setQueueMessageReadMax(int queueMessageReadMax)
This attribute is inherited from Connection at initialization, default value is 1.
queueMessageReadMax
- The maximum number of messages that can be
read at once from a queue.queueMessageReadMax
public final int getTopicAckBufferMax()
This attribute is inherited from Connection at initialization.
FactoryParameters.topicAckBufferMax
,
topicAckBufferMax
public void setTopicAckBufferMax(int topicAckBufferMax)
This attribute is inherited from Connection at initialization.
topicAckBufferMax
- The Maximum number of acknowledgements that
can be buffered in Session.DUPS_OK_ACKNOWLEDGE
mode.FactoryParameters.topicAckBufferMax
,
topicAckBufferMax
public final int getTopicPassivationThreshold()
This threshold is the maximum messages number over which the subscription is passivated.
This attribute is inherited from Connection at initialization, default value is Integer.MAX_VALUE.
topicPassivationThreshold
public void setTopicPassivationThreshold(int topicPassivationThreshold)
This threshold is the maximum messages number over which the subscription is passivated.
This attribute is inherited from Connection at initialization, default value is Integer.MAX_VALUE.
topicPassivationThreshold
- The maximum messages number over which
the subscription is passivated.topicPassivationThreshold
public final int getTopicActivationThreshold()
This threshold is the minimum messages number below which the subscription is activated.
This attribute is inherited from Connection at initialization, default value is 0.
topicActivationThreshold
public void setTopicActivationThreshold(int topicActivationThreshold)
This threshold is the minimum messages number below which the subscription is activated.
This attribute is inherited from Connection at initialization, default value is 0.
topicActivationThreshold
- The minimum messages number below which
the subscription is activated.topicActivationThreshold
public boolean isAsyncSub()
Default value is false, the subscription is handled synchronously so the topic must be accessible.
public void setAsyncSub(boolean asyncSub)
Determines whether the subscription request is asynchronously handled or not.
Default value is false, the subscription is handled synchronously so the topic must be accessible.
asyncSub
- if true sets asynchronous subscription for this session.public void setInMessageInterceptors(java.util.List pInInterceptors)
pInInterceptors
- public void setOutMessageInterceptors(java.util.List pOutInterceptors)
pOutInterceptor
- private void setStatus(int status)
boolean isStarted()
private void setSessionMode(int sessionMode)
private void setRequestStatus(int requestStatus)
protected void checkClosed() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
private void checkThreadOfControl() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
private void checkSessionMode(int expectedSessionMode) throws javax.jms.IllegalStateException
expectedSessionMode
- the expected session mode.
javax.jms.IllegalStateException
public java.lang.String toString()
toString
in class java.lang.Object
public final int getAcknowledgeMode() throws javax.jms.JMSException
getAcknowledgeMode
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.int getAckMode()
public final boolean getTransacted() throws javax.jms.JMSException
getTransacted
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public void setTransacted(boolean t)
public void setMessageListener(javax.jms.MessageListener messageListener) throws javax.jms.JMSException
setMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.Session
javax.jms.JMSException
- Actually never thrown.public javax.jms.Message createMessage() throws javax.jms.JMSException
createMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage() throws javax.jms.JMSException
TextMessage
object.
API method.
createTextMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.TextMessage createTextMessage(java.lang.String text) throws javax.jms.JMSException
TextMessage
object with the specified text.
API method.
createTextMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.BytesMessage createBytesMessage() throws javax.jms.JMSException
BytesMessage
object.
API method.
createBytesMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.MapMessage createMapMessage() throws javax.jms.JMSException
MapMessage
object.
API method.
createMapMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage() throws javax.jms.JMSException
ObjectMessage
object.
API method.
createObjectMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable obj) throws javax.jms.JMSException
ObjectMessage
object.
API method.
createObjectMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.StreamMessage createStreamMessage() throws javax.jms.JMSException
StreamMessage
object.
API method.
createStreamMessage
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue, java.lang.String selector) throws javax.jms.JMSException
createBrowser
in interface javax.jms.Session
queue
- the queue to browseselector
- the expression allowing to filter messages
javax.jms.IllegalStateException
- if the session is closed.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.InvalidSelectorException
- if the message selector is invalid.
javax.jms.JMSException
public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue) throws javax.jms.JMSException
createBrowser
in interface javax.jms.Session
queue
- the queue to browse
javax.jms.IllegalStateException
- if the session is closed.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.JMSException
public javax.jms.MessageProducer createProducer(javax.jms.Destination dest) throws javax.jms.JMSException
createProducer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest, java.lang.String selector) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
dest
- the Destination to send to, or null if this is a producer which does not have
a specified destination.selector
- The selector allowing to filter messages.
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.MessageConsumer createConsumer(javax.jms.Destination dest) throws javax.jms.JMSException
createConsumer
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name, java.lang.String selector, boolean noLocal) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic, java.lang.String name) throws javax.jms.JMSException
createDurableSubscriber
in interface javax.jms.Session
javax.jms.InvalidDestinationException
- if an invalid destination is specified.
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the creation fails for any other reason.public javax.jms.Queue createQueue(java.lang.String name) throws javax.jms.JMSException
If the given name is a provider-specific name (#x.y.z unique identifier) a queue identity is returned with the specified identifier.
API method.
Clients that depend on this ability are not portable. Normally the physical creation of destination is an administrative task and is not to be initiated by the JMS API.
createQueue
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
- If the topic creation failed.public javax.jms.Topic createTopic(java.lang.String name) throws javax.jms.JMSException
If the given name is a provider-specific name (#x.y.z unique identifier) a topic identity is returned with the specified identifier.
API method.
Clients that depend on this ability are not portable. Normally the physical creation of destination is an administrative task and is not to be initiated by the JMS API.
createTopic
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed.
javax.jms.JMSException
- If the topic creation failed.private java.lang.String createDestination(byte type, java.lang.String name) throws javax.jms.JMSException
type
- the type of the destination to create.name
- the name of the destination to create.
javax.jms.JMSException
public javax.jms.TemporaryQueue createTemporaryQueue() throws javax.jms.JMSException
createTemporaryQueue
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the request fails for any other reason.public javax.jms.TemporaryTopic createTemporaryTopic() throws javax.jms.JMSException
createTemporaryTopic
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.JMSException
- If the request fails for any other reason.public void run()
run
in interface java.lang.Runnable
run
in interface javax.jms.Session
void setMessageConsumerListener(MessageConsumerListener mcl)
public void commit() throws javax.jms.JMSException
commit
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or not
transacted, or if the connection is broken.
javax.jms.JMSException
public void rollback() throws javax.jms.JMSException
rollback
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or not
transacted.
javax.jms.JMSException
public void recover() throws javax.jms.JMSException
recover
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed, or transacted.
javax.jms.JMSException
private void doRecover() throws javax.jms.JMSException
javax.jms.JMSException
public void unsubscribe(java.lang.String name) throws javax.jms.JMSException
unsubscribe
in interface javax.jms.Session
javax.jms.IllegalStateException
- If the session is closed or if the
connection is broken.
javax.jms.InvalidDestinationException
- If the subscription does not
exist.
javax.jms.JMSException
- If the request fails for any other reason.public void close() throws javax.jms.JMSException
close
in interface javax.jms.Session
javax.jms.JMSException
void doClose() throws javax.jms.JMSException
javax.jms.JMSException
void start()
This method is called by a started connection.
private void doStart()
void stop()
This method must be carefully used. When the session is stopped, the connection might very well going on pushing deliveries in the session's queue. If the session is never re-started, these deliveries will never be popped out, and this may lead to a situation of consumed but never acknowledged messages.
This fatal situation never occurs as the stop()
method is
either called by he Session.close()
and Connection.stop()
methods, which first empties the
session's deliveries and forbid any further push.
private void doStop()
private void prepareSend(Destination dest, Message msg) throws javax.jms.JMSException
dest
- The destination the message is destinated to.msg
- The message.
javax.jms.JMSException
private void prepareAck(java.lang.String name, java.lang.String id, boolean queueMode)
name
- Name of the destination or of the proxy subscription
the message comes from.id
- Identifier of the consumed message.queueMode
- true
if the message consumed comes from
a queue.void acknowledge() throws javax.jms.JMSException
javax.jms.JMSException
private void doAcknowledge() throws javax.jms.JMSException
javax.jms.JMSException
private void deny() throws javax.jms.JMSException
javax.jms.JMSException
javax.jms.Message receive(long requestTimeToLive, long waitTimeOut, MessageConsumer mc, java.lang.String targetName, java.lang.String selector, boolean queueMode) throws javax.jms.JMSException
javax.jms.JMSException
private void preReceive(MessageConsumer mc) throws javax.jms.JMSException
javax.jms.JMSException
private void postReceive()
protected void addConsumer(MessageConsumer mc)
void closeConsumer(MessageConsumer mc)
void checkConsumers(java.lang.String agentId) throws javax.jms.JMSException
javax.jms.JMSException
protected void addProducer(MessageProducer mp)
void closeProducer(MessageProducer mp)
void closeBrowser(QueueBrowser qb)
MessageConsumerListener addMessageListener(MessageConsumerListener mcl) throws javax.jms.JMSException
javax.jms.JMSException
void removeMessageListener(MessageConsumerListener mcl, boolean check) throws javax.jms.JMSException
javax.jms.JMSException
void pushMessages(SingleSessionConsumer consumerListener, ConsumerMessages messages)
void onMessage(Message msg)
private void denyMessage(java.lang.String targetName, java.lang.String msgId, boolean queueMode) throws javax.jms.JMSException
javax.jms.JMSException
private void onMessages(Session.MessageListenerContext ctx) throws javax.jms.JMSException
javax.jms.JMSException
void onMessage(Message momMsg, MessageConsumerListener mcl) throws javax.jms.JMSException
javax.jms.JMSException
void send(Destination dest, javax.jms.Message msg, int deliveryMode, int priority, long timeToLive, boolean timestampDisabled) throws javax.jms.JMSException
javax.jms.JMSException
AbstractJmsReply syncRequest(AbstractJmsRequest request) throws javax.jms.JMSException
javax.jms.JMSException
final Connection getConnection()
final java.lang.String getId()
final RequestMultiplexer getRequestMultiplexer()
public final boolean isAutoAck()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |