Package com.sun.ts.tests.jms.common
Class SessionThread
java.lang.Object
java.lang.Thread
com.sun.ts.tests.jms.common.SessionThread
- All Implemented Interfaces:
Runnable
Class Declaration.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionSessionThread
(jakarta.jms.QueueConnection qC, jakarta.jms.TopicConnection tC) Default constructor creates Session Thread with connections specified. -
Method Summary
Modifier and TypeMethodDescriptionvoid
createConsumer
(jakarta.jms.Destination dest) Create message consumersvoid
createProducer
(jakarta.jms.Destination dest) Create message producersint
Get the number of messages that have been received by this thread.jakarta.jms.QueueSession
Return the current QueueSessionjakarta.jms.TopicSession
Return the current TopicSessionvoid
Reset the number of messages that have been received by this thread.void
run()
Run methodvoid
setQueueSession
(boolean transacted, int mode) Method for specifying the QueueSession attributes.void
setReplyToMessages
(boolean boo) Set to true to have SessionThread reply automatically to messages.void
setStayAlive
(boolean boo) Set to true to have SessionThread keep receiving messages indefinitely.void
setTopicSession
(boolean transacted, int mode) Method for specifying the TopicSession attributes..void
Used to start the Queue and Topic Connections when they are not the default Connections.void
Used to start only the specified Connection.void
Used to start only the specified Connection.void
Stop itMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
SessionThread
public SessionThread(jakarta.jms.QueueConnection qC, jakarta.jms.TopicConnection tC) throws jakarta.jms.JMSException Default constructor creates Session Thread with connections specified.- Parameters:
QueueConnection
- for creating QueueSessionsTopicConnection
- for creating TopicSessions- Throws:
jakarta.jms.JMSException
-
-
Method Details
-
setQueueSession
public void setQueueSession(boolean transacted, int mode) throws jakarta.jms.JMSException Method for specifying the QueueSession attributes.- Parameters:
boolean
- transactedint
- acknowledgement mode- Throws:
jakarta.jms.JMSException
-
setTopicSession
public void setTopicSession(boolean transacted, int mode) throws jakarta.jms.JMSException Method for specifying the TopicSession attributes..- Parameters:
boolean
- transactedint
- acknowledgement mode- Throws:
jakarta.jms.JMSException
-
getQueueSession
public jakarta.jms.QueueSession getQueueSession()Return the current QueueSession- Returns:
- QueueSession the current QueueSession for this client
-
getTopicSession
public jakarta.jms.TopicSession getTopicSession()Return the current TopicSession- Returns:
- TopicSession the current TopicSession for this client
-
startConnection
public void startConnection() throws jakarta.jms.JMSExceptionUsed to start the Queue and Topic Connections when they are not the default Connections. May also be used in place of someConnection.start() within the main testing method.- Throws:
jakarta.jms.JMSException
-
startQueueConnection
Used to start only the specified Connection. Useful when it is not the default Connection.- Throws:
Exception
-
startTopicConnection
Used to start only the specified Connection. Useful when it is not the default Connection.- Throws:
Exception
-
createProducer
Create message producers- Parameters:
Destination
- Queue or Topic- Throws:
Exception
-
createConsumer
Create message consumers- Parameters:
Destination
- Queue or Topic- Throws:
Exception
-
setReplyToMessages
public void setReplyToMessages(boolean boo) Set to true to have SessionThread reply automatically to messages.- Parameters:
boolean
- true for automatic request/reply
-
setStayAlive
public void setStayAlive(boolean boo) Set to true to have SessionThread keep receiving messages indefinitely.- Parameters:
boolean
- true for indefinite receive()
-
getMessagesReceivedCount
public int getMessagesReceivedCount()Get the number of messages that have been received by this thread.- Returns:
- int number of messages received
-
resetMessagesReceivedCount
public void resetMessagesReceivedCount()Reset the number of messages that have been received by this thread. Useful once "steady-state" has been reached. -
stopWaiting
public void stopWaiting() throws jakarta.jms.JMSExceptionStop it- Throws:
jakarta.jms.JMSException
-
run
public void run()Run method
-