Class SessionThread

java.lang.Object
java.lang.Thread
com.sun.ts.tests.jms.common.SessionThread
All Implemented Interfaces:
Runnable

public class SessionThread extends Thread
Class Declaration.
  • 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 QueueSessions
      TopicConnection - 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 - transacted
      int - 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 - transacted
      int - 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.JMSException
      Used 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

      public void startQueueConnection() throws Exception
      Used to start only the specified Connection. Useful when it is not the default Connection.
      Throws:
      Exception
    • startTopicConnection

      public void startTopicConnection() throws Exception
      Used to start only the specified Connection. Useful when it is not the default Connection.
      Throws:
      Exception
    • createProducer

      public void createProducer(jakarta.jms.Destination dest) throws Exception
      Create message producers
      Parameters:
      Destination - Queue or Topic
      Throws:
      Exception
    • createConsumer

      public void createConsumer(jakarta.jms.Destination dest) throws Exception
      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.JMSException
      Stop it
      Throws:
      jakarta.jms.JMSException
    • run

      public void run()
      Run method
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread