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 TypeMethodDescriptionvoidcreateConsumer(jakarta.jms.Destination dest) Create message consumersvoidcreateProducer(jakarta.jms.Destination dest) Create message producersintGet the number of messages that have been received by this thread.jakarta.jms.QueueSessionReturn the current QueueSessionjakarta.jms.TopicSessionReturn the current TopicSessionvoidReset the number of messages that have been received by this thread.voidrun()Run methodvoidsetQueueSession(boolean transacted, int mode) Method for specifying the QueueSession attributes.voidsetReplyToMessages(boolean boo) Set to true to have SessionThread reply automatically to messages.voidsetStayAlive(boolean boo) Set to true to have SessionThread keep receiving messages indefinitely.voidsetTopicSession(boolean transacted, int mode) Method for specifying the TopicSession attributes..voidUsed to start the Queue and Topic Connections when they are not the default Connections.voidUsed to start only the specified Connection.voidUsed to start only the specified Connection.voidStop 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
-