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