KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > client > MulticastTopicConnectionFactory


1 package com.ubermq.jms.client;
2
3 import com.ubermq.jms.client.impl.*;
4 import com.ubermq.jms.client.multicast.*;
5 import java.net.*;
6 import javax.jms.*;
7
8 /**
9  * Instantiates a topic connection using the UberMQ LRMP multicast
10  * implementation.
11  */

12 public class MulticastTopicConnectionFactory
13     implements javax.jms.TopicConnectionFactory JavaDoc, java.io.Serializable JavaDoc
14 {
15     private SocketAddress addr;
16
17     public static final long serialVersionUID = 1L;
18
19     /**
20      * Creates a factory to create connections on the given
21      * multicast address and port.
22      * @param host a multicast (class D) address.
23      * @param port the port
24      */

25     public MulticastTopicConnectionFactory(String JavaDoc host, int port)
26     {
27         this.addr = new InetSocketAddress(host, port);
28     }
29
30     public MulticastTopicConnectionFactory(URI uri)
31     {
32         this(uri.getHost(),
33                  (uri.getPort() > 0) ? uri.getPort() : com.ubermq.jms.common.MessageConstants.DEFAULT_PORT);
34     }
35
36     public javax.jms.TopicConnection JavaDoc createTopicConnection()
37         throws JMSException
38     {
39         try {
40             return new MulticastTopicConnection(new SimpleInternetConnectionDescriptor(addr));
41         } catch(Exception JavaDoc x) {throw new JMSException(x.toString());}
42     }
43
44     public javax.jms.TopicConnection JavaDoc createTopicConnection(String JavaDoc p0, String JavaDoc p1)
45         throws JMSException
46     {
47         return createTopicConnection();
48     }
49
50     public javax.jms.Connection JavaDoc createConnection(String JavaDoc p0, String JavaDoc p1) throws JMSException
51     {
52         return createTopicConnection(p0, p1);
53     }
54
55     public javax.jms.Connection JavaDoc createConnection() throws JMSException
56     {
57         return createTopicConnection();
58     }
59
60
61 }
62
Popular Tags