Author: ron.sigal(a)jboss.com
Date: 2008-04-24 02:12:57 -0400 (Thu, 24 Apr 2008)
New Revision: 4056
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
Log:
JBREM-930: Made handleNotification() synchronized.
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-04-24
05:40:19 UTC (rev 4055)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-04-24
06:12:57 UTC (rev 4056)
@@ -27,6 +27,8 @@
import java.security.PrivilegedExceptionAction;
import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.detection.ServerInvokerMetadata;
import org.jboss.remoting.detection.multicast.MulticastDetector;
@@ -46,6 +48,7 @@
*/
public class NetworkRegistryTestCase extends TestCase implements NotificationListener
{
+ private static Logger log = Logger.getLogger(NetworkRegistryTestCase.class);
private String subSystem = null;
private int numOfAdded = 0;
private int numOfUpdated = 0;
@@ -93,11 +96,11 @@
// set config info for detector and start it.
detector1.start();
- System.out.println("First set started.");
+ log.info("First set started.");
Thread.sleep(3000);
- System.out.println("Starting second set.");
+ log.info("Starting second set.");
MBeanServer server2 = null;
try
@@ -131,18 +134,18 @@
// set config info for detector and start it.
detector2.start();
- System.out.println("Second set started.");
+ log.info("Second set started.");
Thread.sleep(5000);
// should have detected both new locators
assertEquals(2, numOfAdded);
- System.out.println("Stopping first set.");
+ log.info("Stopping first set.");
connector1.stop();
connector1.destroy();
detector1.stop();
- System.out.println("First set stopped.");
+ log.info("First set stopped.");
//DEBUG
// Thread.sleep(6000000);
@@ -153,11 +156,11 @@
// thus leaving only one valid locator
assertEquals(1, numOfUpdated);
- System.out.println("Stopping second set.");
+ log.info("Stopping second set.");
connector2.stop();
connector2.destroy();
detector2.stop();
- System.out.println("Stopped second set.");
+ log.info("Stopped second set.");
Thread.sleep(15000);
@@ -169,31 +172,31 @@
}
- public void handleNotification(Notification notification, Object o)
+ public synchronized void handleNotification(Notification notification, Object o)
{
- System.out.println("Received notification: " + notification);
+ log.info("Received notification: " + notification);
if (notification instanceof NetworkNotification)
{
NetworkNotification netNot = (NetworkNotification) notification;
if(NetworkNotification.SERVER_ADDED.equals(netNot.getType()))
{
numOfAdded = netNot.getLocator().length;
- //System.out.println("server added. num of locators added = " +
numOfAdded);
+ log.info("server added. num of locators added = " + numOfAdded);
}
else if(NetworkNotification.SERVER_UPDATED.equals(netNot.getType()))
{
numOfUpdated = netNot.getLocator().length;
- //System.out.println("server updated. num of locators in update =
" + numOfAdded);
+ log.info("server updated. num of locators in update = " +
numOfAdded);
}
ServerInvokerMetadata[] serverMetadata = netNot.getServerInvokers();
- System.out.println(netNot.getIdentity());
- System.out.println(serverMetadata);
+ log.info(netNot.getIdentity());
+ log.info(serverMetadata);
InvokerLocator[] locators = netNot.getLocator();
if (locators != null)
{
for (int x = 0; x < locators.length; x++)
{
- System.out.println(locators[x]);
+ log.info(locators[x]);
}
}
subSystem = serverMetadata[0].getSubSystems()[0];
@@ -217,7 +220,7 @@
}
catch (PrivilegedActionException e)
{
- System.out.println(e.getCause());
+ log.info(e.getCause());
throw (Exception) e.getCause();
}
}
@@ -238,7 +241,7 @@
}
catch (PrivilegedActionException e)
{
- System.out.println(e.getCause());
+ log.info(e.getCause());
throw (Exception) e.getCause();
}
}
Show replies by date