1 18 package org.apache.activemq.broker.util; 19 20 import java.io.IOException ; 21 import java.net.DatagramSocket ; 22 import java.net.MulticastSocket ; 23 import java.net.URI ; 24 import java.net.URISyntaxException ; 25 26 33 public class MulticastTraceBrokerPlugin extends UDPTraceBrokerPlugin { 34 35 private int timeToLive = 1; 36 37 public MulticastTraceBrokerPlugin() { 38 try { 39 destination = new URI ("multicast://224.1.2.3:61616"); 40 } catch (URISyntaxException wontHappen) { 41 } 42 } 43 44 protected DatagramSocket createSocket() throws IOException { 45 MulticastSocket s = new MulticastSocket (); 46 s.setSendBufferSize(maxTraceDatagramSize); 47 s.setBroadcast(broadcast); 48 s.setLoopbackMode(true); 49 s.setTimeToLive(timeToLive); 50 return s; 51 } 52 53 public int getTimeToLive() { 54 return timeToLive; 55 } 56 57 public void setTimeToLive(int timeToLive) { 58 this.timeToLive = timeToLive; 59 } 60 61 } 62 | Popular Tags |