1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.multicast;
12
13 import org.mule.api.endpoint.InboundEndpoint;
14 import org.mule.api.lifecycle.InitialisationException;
15 import org.mule.api.service.Service;
16 import org.mule.transport.udp.UdpConnector;
17
18
19
20
21 public class MulticastConnector extends UdpConnector
22 {
23
24 public static final String MULTICAST = "multicast";
25 private boolean loopback = false;
26 private int timeToLive = INT_VALUE_NOT_SET;
27
28 public String getProtocol()
29 {
30 return MULTICAST;
31 }
32
33
34
35 protected void doInitialise() throws InitialisationException
36 {
37 dispatcherSocketsPool.setFactory(new MulticastSocketFactory());
38 dispatcherSocketsPool.setTestOnBorrow(false);
39 dispatcherSocketsPool.setTestOnReturn(true);
40
41
42
43 }
44
45 public boolean isLoopback()
46 {
47 return loopback;
48 }
49
50 public void setLoopback(boolean loopback)
51 {
52 this.loopback = loopback;
53 }
54
55
56 public int getTimeToLive()
57 {
58 return timeToLive;
59 }
60
61 public void setTimeToLive(int timeToLive)
62 {
63 this.timeToLive = timeToLive;
64 }
65
66
67
68 protected Object getReceiverKey(Service service, InboundEndpoint endpoint)
69 {
70
71
72 return endpoint.getEndpointURI().getAddress() + "/" + service.getName();
73 }
74 }