[jboss-dev-forums] [Design of JBoss Remoting, Unified Invokers] - Re: Bisocket server invoker NPE

timfox do-not-reply at jboss.com
Wed Mar 14 10:27:58 EDT 2007


"ron.sigal at jboss.com" wrote : I looked at some old logs, and it looks like the problem is associated with tests that deliberately kill the server
  | 

Yes, I noticed this during crash and failover tests.

anonymous wrote :  The NullPointerException seems to occur because the client invoker has closed before the ControlMonitorTimerTask has stopped running.  I'm not sure how this is happening, but it could be that the TimerTask was in the middle of running when the client invoker closed. 
  | 

When using a timer, you can ensure the task has finished running by doing the following:

(from java.util.Timer javadoc - cancel method)
anonymous wrote : 
  | Note that calling this method from within the run method of a timer task that was invoked by this timer absolutely guarantees that the ongoing task execution is the last task execution that will ever be performed by this timer.
  | 

So you just need to add a sychronized stop() method to the TimerTask which calls cancel() and make sure you call this from your code - take a look at org.jboss.messaging.core.plugin.postoffice.cluster.StatsSender which does something very similar.

anonymous wrote : 
  | In any case, I've modified the code to avoid the NPE and print a warning message.
  | 

Is a warning message really appropriate? A warning would imply something wrong or strange - but this is to be expected.

anonymous wrote : 
  | I ran the JBM functional tests, and they all pass except for occasional failures in FailoverValveTest at line 287
  | 
  | 
  |   |          assertNotNull(o);
  |   | 
  | 
  | I reran FailoverValveTest with the remoting jar from the SVN repository and the same thing happened, so I don't think I broke anything new.

FailoverValve is not currently used so I wouldn't worry too much about this. We need to address this in the test suite.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027942#4027942

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027942



More information about the jboss-dev-forums mailing list