[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...

Tom Elrod tom.elrod at jboss.com
Tue Dec 12 09:49:23 EST 2006


  User: telrod  
  Date: 06/12/12 09:49:23

  Modified:    src/main/org/jboss/remoting  ConnectionValidator.java
  Log:
  JBREM-648 - fixe NPE for connection validator when client disconnects.
  
  Revision  Changes    Path
  1.15      +19 -4     JBossRemoting/src/main/org/jboss/remoting/ConnectionValidator.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConnectionValidator.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/ConnectionValidator.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- ConnectionValidator.java	12 Dec 2006 05:14:40 -0000	1.14
  +++ ConnectionValidator.java	12 Dec 2006 14:49:22 -0000	1.15
  @@ -45,6 +45,9 @@
   
      protected static final Logger log = Logger.getLogger(ConnectionValidator.class.getName());
   
  +   private Object lock = new Object();
  +   private boolean stopped = false;
  +
      /**
       * Default ping period.  Value is 2 seconds.
       */
  @@ -64,15 +67,20 @@
      private void start()
      {
         TimerUtil.schedule(this, pingPeriod);
  +      stopped = false;
      }
   
      public void stop()
      {
  +      synchronized(lock)
  +      {
         cancel();
         if (!listeners.isEmpty())
         {
            listeners.clear();
      }
  +         stopped = true;
  +   }
      }
   
   
  @@ -113,6 +121,10 @@
       */
      public void run()
      {
  +      synchronized(lock)
  +      {
  +         if(!stopped)
  +         {
         try
         {
            boolean isValid = checkConnection(client.getInvoker().getLocator(), client.getConfiguration());
  @@ -126,6 +138,8 @@
            notifyListeners(thr);
         }
      }
  +      }
  +   }
   
      private void notifyListeners(Throwable thr)
      {
  @@ -162,10 +176,11 @@
      {
         boolean pingWorked = false;
   
  -      HashMap configMap = new HashMap();
  -      if (config != null)
  -         configMap.putAll(config);
  -
  +      Map configMap = config;
  +      if (configMap == null)
  +      {
  +         configMap = new HashMap();
  +      }
         configMap.put("connection_checker", "true");
         configMap.put("timeout", "1000");
         configMap.put("NumberOfRetries", "1");
  
  
  



More information about the jboss-cvs-commits mailing list