Author: ron.sigal(a)jboss.com
Date: 2009-04-11 21:46:00 -0400 (Sat, 11 Apr 2009)
New Revision: 4969
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetectorMBean.java
Log:
JBREM-1099: Added bufferSize attribute.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2009-04-12
01:44:36 UTC (rev 4968)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetector.java 2009-04-12
01:46:00 UTC (rev 4969)
@@ -55,6 +55,7 @@
private int port = 2410;
private MulticastSocket socket;
private Listener listener = new Listener("Remoting Multicast Detector - Listener
Thread: " + threadCounter++);
+ private int bufferSize = 10000;
/**
@@ -133,6 +134,17 @@
this.port = port;
}
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+
+ public void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+
/**
* called by MBeanServer to start the mbean lifecycle
*
@@ -210,6 +222,9 @@
if(socket != null)
{
Detection msg = createDetection();
+ if (msg == null)
+ return;
+
try
{
if(log.isTraceEnabled())
@@ -324,7 +339,8 @@
public void run()
{
- byte[] buf = new byte[4000];
+ log.debug("Using bufferSize: " + bufferSize);
+ byte[] buf = new byte[bufferSize];
DatagramPacket p = new DatagramPacket(buf, 0, buf.length);
//p.setAddress(addr);
//p.setPort(port);
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetectorMBean.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetectorMBean.java 2009-04-12
01:44:36 UTC (rev 4968)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/detection/multicast/MulticastDetectorMBean.java 2009-04-12
01:46:00 UTC (rev 4969)
@@ -84,5 +84,15 @@
* @param defaultIP The IP that is used to broadcast detection messages on via
multicast.
*/
void setDefaultIP(String defaultIP);
+
+ /**
+ * @return The size of the byte array in the DatagramPacket.
+ */
+ int getBufferSize();
+
+ /**
+ * @param bufferSize The size of the byte array in the DatagramPacket.
+ */
+ void setBufferSize(int bufferSize);
}