|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrun.jms.core.client.JmsSession
This class implements a Session interface and supports a single threaded context. A session supports multiple consumers and producers but only within the context of a single thread, which is the thread creating this object. Any attempt to use an instance of this class in a thread, aside from the one that created it will result in a MessageException
| Field Summary | |
static java.lang.String |
MESSAGES_TO_COMMIT
|
static java.lang.String |
MESSAGES_TO_ROLLBACK
|
| Method Summary | |
void |
acknowledgeMessage(javax.jms.Message message)
Acknowledge the specified message. |
protected void |
addConsumer(JmsMessageConsumer consumer)
Add a consumer to the list of consumers managed by this session |
protected void |
addProducer(JmsMessageProducer producer)
Add a producer to the list of producers managed by this session |
void |
close()
|
void |
commit()
|
void |
commit(java.lang.String[] receivedMessages)
|
javax.jms.BytesMessage |
createBytesMessage()
|
javax.jms.MapMessage |
createMapMessage()
|
javax.jms.Message |
createMessage()
|
javax.jms.ObjectMessage |
createObjectMessage()
|
javax.jms.ObjectMessage |
createObjectMessage(java.io.Serializable object)
|
javax.jms.StreamMessage |
createStreamMessage()
|
javax.jms.TextMessage |
createTextMessage()
|
javax.jms.TextMessage |
createTextMessage(java.lang.String text)
|
void |
destroy()
Release local resources used by this session object |
void |
enableAsynchronousDelivery(long clientId,
long id,
boolean enable)
Enable or disable asynchronous message delivery for the specified client. |
void |
execute(java.lang.Object object)
This is the called to process messages asynchronously delivered by the server. |
int |
getAckMode()
Return the acknowledgement mode for the session |
protected JmsSessionStubIfc |
getJmsSessionStub()
Return an instance of the remote stub. |
protected Logger |
getLogger()
Return a reference to the logger. |
javax.jms.MessageListener |
getMessageListener()
|
protected long |
getNextConsumerId()
Returns the next seed value to be allocated to a new consumer |
java.lang.String |
getSessionId()
Return a reference to the session identifier |
boolean |
getTransacted()
|
protected boolean |
isClosed()
Check if the session is closed |
boolean |
isClosing()
|
boolean |
isStopped()
(Kint added 11/15/01) Needed so that consumers can determine if the connection is stopped so they know if non-blocking forms of receive [e.g.: receive(int timeOut) or receiveNoWait()] should return a message. |
void |
onMessage(javax.jms.Message message)
This method is called when a messsges is asynchronously delivered to this session from the server. |
void |
onMessage(javax.jms.Message message,
boolean autocommit)
This method is called when a messsges is asynchronously delivered to this session from the ConnectionConsumer through the ServerSession pool. |
void |
onMessages(java.util.Vector messages)
Process the collection of messages from the provider. |
void |
onMessages(java.util.Vector messages,
boolean autocommit)
Process the collection of messages from the provider. |
void |
processMessages()
|
void |
recover()
|
protected void |
removeConsumer(JmsMessageConsumer consumer)
Remove the consumer with the specified id from the list of managed consumers |
void |
removeMessageListener(JmsMessageConsumer listener)
Remove the message listener for the specified destination |
protected void |
removeProducer(JmsMessageProducer producer)
Remove the producer from the list of managed producers |
javax.jms.Message |
retrieveMessage(long clientId)
Fetch the next message for this client. |
java.util.Vector |
retrieveMessages(long clientId,
int count)
Fetch upto count messages from the endpoint. |
void |
rollback()
|
void |
rollback(java.lang.String[] messages)
|
void |
run()
|
protected void |
sendMessage(javax.jms.Message message)
Send the specified message to the server. |
void |
setMessageListener(JmsMessageConsumer listener)
This will set the message listener for a particular consumer. |
void |
setMessageListener(javax.jms.MessageListener listener)
|
protected void |
setParent(JmsSession session)
|
protected void |
setUseByAplicationServerFacilities()
Setst useByAplicationServerFacilities attribute, to signal that JMSsession have been used by ServerSession |
void |
start()
This will start message delivery to this session. |
void |
stop()
This will stop message delivery to this session. |
| Field Detail |
public static final java.lang.String MESSAGES_TO_COMMIT
public static final java.lang.String MESSAGES_TO_ROLLBACK
| Method Detail |
public boolean isStopped()
public boolean isClosing()
protected void setUseByAplicationServerFacilities()
protected void setParent(JmsSession session)
public javax.jms.BytesMessage createBytesMessage()
throws javax.jms.JMSException
public javax.jms.MapMessage createMapMessage()
throws javax.jms.JMSException
public javax.jms.Message createMessage()
throws javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage()
throws javax.jms.JMSException
public javax.jms.ObjectMessage createObjectMessage(java.io.Serializable object)
throws javax.jms.JMSException
public javax.jms.StreamMessage createStreamMessage()
throws javax.jms.JMSException
public javax.jms.TextMessage createTextMessage()
throws javax.jms.JMSException
public javax.jms.TextMessage createTextMessage(java.lang.String text)
throws javax.jms.JMSException
public boolean getTransacted()
throws javax.jms.JMSException
public void commit(java.lang.String[] receivedMessages)
throws javax.jms.JMSException
public void commit()
throws javax.jms.JMSException
public void rollback()
throws javax.jms.JMSException
public void rollback(java.lang.String[] messages)
throws javax.jms.JMSException
public void close()
throws javax.jms.JMSException
public void recover()
throws javax.jms.JMSException
public javax.jms.MessageListener getMessageListener()
throws javax.jms.JMSException
public void setMessageListener(javax.jms.MessageListener listener)
throws javax.jms.JMSException
public void processMessages()
public void run()
public void setMessageListener(JmsMessageConsumer listener)
throws javax.jms.JMSException
If a listener is already registered for the consumer, it will be automatically overwritten
listener - the message listener
public void removeMessageListener(JmsMessageConsumer listener)
throws javax.jms.JMSException
listener - the message listener
public void start()
throws javax.jms.JMSException
It will throw a JMSException is the connection hasn't been started
JMSException -
public void stop()
throws javax.jms.JMSException
JMSException -
public void acknowledgeMessage(javax.jms.Message message)
throws javax.jms.JMSException
Acking a message automatically acks all those that have come before it.
If there is any problem with the acking then throw a JMSException exception
acknowledgeMessage in interface MessageSessionIfcmessage - message to acknowledgeJMSException -
public void enableAsynchronousDelivery(long clientId,
long id,
boolean enable)
throws javax.jms.JMSException
clientId - - the client identityid - - the last message delivered asynchronouslyenable - - true to enable; false to disableJMSException -
public void onMessage(javax.jms.Message message,
boolean autocommit)
object - received messagepublic void onMessage(javax.jms.Message message)
object - received messagepublic void onMessages(java.util.Vector messages)
MessageImpl objects.
These messages are added to the incoming queue and processed asynchronously
onMessages in interface JmsMessageListenermessages - - collection of messageas
public void onMessages(java.util.Vector messages,
boolean autocommit)
MessageImpl objects.
These messages are added to the incoming queue and processed asynchronously
messages - - collection of messageaspublic void execute(java.lang.Object object)
If the session has a registered listener then all messages will be delivered to the session's listener instead of the individual consumer message listeners.
execute in interface QueueWorkerobject - received messagepublic java.lang.String getSessionId()
public int getAckMode()
protected void sendMessage(javax.jms.Message message)
throws javax.jms.JMSException
message - message to sendJMSException - protected JmsSessionStubIfc getJmsSessionStub()
protected Logger getLogger()
protected long getNextConsumerId()
protected void addConsumer(JmsMessageConsumer consumer)
consumer - - the consumer to addprotected void removeConsumer(JmsMessageConsumer consumer)
id - - the consumer id to removeprotected void addProducer(JmsMessageProducer producer)
producer - - the producer to addprotected void removeProducer(JmsMessageProducer producer)
producer - - the producer to removeprotected boolean isClosed()
public javax.jms.Message retrieveMessage(long clientId)
throws javax.jms.JMSException
clientId - - scoped to the sessionJMSException -
public java.util.Vector retrieveMessages(long clientId,
int count)
throws javax.jms.JMSException
JmsQueueBrowser..clientId - - scoped to the sessioncount - - max messages to retrieve.JMSException -
public void destroy()
throws javax.jms.JMSException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||