A.4. Utility Class

The SampleUtilities class, in SampleUtilities.java, is a utility class for the other sample programs. It contains the following methods:

  • getQueueConnectionFactory

  • getTopicConnectionFactory

  • getQueue

  • getTopic

  • jndiLookup

  • receiveSynchronizeMessages

  • sendSynchronizeMessages

It also contains the class DoneLatch, which has the following methods:

  • waitTillDone

  • allDone

Example A.4. SampleUtilities.java
 import javax.naming.*; import javax.jms.*; public class SampleUtilities { public static final String QUEUECONFAC = "QueueConnectionFactory"; public static final String TOPICCONFAC = "TopicConnectionFactory"; private static Context jndiContext = null; /** * Returns a QueueConnectionFactory object. * * @return a QueueConnectionFactory object * ...

Get Java™ Message Service API Tutorial and Reference: Messaging for the J2EE™ Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.