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

Ovidiu Feodorov ovidiu.feodorov at jboss.com
Wed Jan 24 21:51:43 EST 2007


  User: ovidiu  
  Date: 07/01/24 21:51:43

  Modified:    src/main/org/jboss/remoting/callback   Tag: remoting_2_x
                        DefaultCallbackErrorHandler.java
                        ServerInvokerCallbackHandler.java
  Log:
  fixed http://jira.jboss.org/jira/browse/JBREM-689; not added test cases though because I couldn't figure how to use existing CallbackTestCase
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.4.2   +15 -15    JBossRemoting/src/main/org/jboss/remoting/callback/DefaultCallbackErrorHandler.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DefaultCallbackErrorHandler.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/callback/DefaultCallbackErrorHandler.java,v
  retrieving revision 1.3.4.1
  retrieving revision 1.3.4.2
  diff -u -b -r1.3.4.1 -r1.3.4.2
  --- DefaultCallbackErrorHandler.java	25 Jan 2007 01:07:10 -0000	1.3.4.1
  +++ DefaultCallbackErrorHandler.java	25 Jan 2007 02:51:43 -0000	1.3.4.2
  @@ -113,15 +113,18 @@
         }
      }
   
  -   public void handleError(Throwable ex) throws Throwable
  +   public synchronized void handleError(Throwable ex) throws Throwable
      {
         currentNumberOfErrors++;
   
  -      log.debug(this + " caught " + ex + " exception performing callback. Number of errors " +
  -         "sending callbacks is " + currentNumberOfErrors);
  +      log.debug(this + " handling " + ex + ". Number of errors so far " + currentNumberOfErrors);
   
  -      if (currentNumberOfErrors >= numOfErrorsAllowed)
  +      if (currentNumberOfErrors < numOfErrorsAllowed)
         {
  +         log.debug(this + " ignoring the callback error");
  +         throw ex;
  +      }
  +
            log.warn(this + " reached maximum number of callback errors allowed (" +
               numOfErrorsAllowed + "). Will clean up callback hander now.");
   
  @@ -130,13 +133,10 @@
               serverInvoker.removeCallbackListener(handlerSubsystem, callbackHandler);
               callbackHandler.destroy();
            }
  -      }
  -      else
  -      {
  -         log.debug(this + " ignoring the callback error");
  +
  +      // rethrowing the exception so the client application can catch it and handle it too
            throw ex;
         }
  -   }
   
      public void setServerInvoker(ServerInvoker serverInvoker)
      {
  
  
  
  1.15.2.9  +10 -8     JBossRemoting/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ServerInvokerCallbackHandler.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java,v
  retrieving revision 1.15.2.8
  retrieving revision 1.15.2.9
  diff -u -b -r1.15.2.8 -r1.15.2.9
  --- ServerInvokerCallbackHandler.java	25 Jan 2007 01:07:10 -0000	1.15.2.8
  +++ ServerInvokerCallbackHandler.java	25 Jan 2007 02:51:43 -0000	1.15.2.9
  @@ -697,17 +697,19 @@
               }
               catch(Throwable ex)
               {
  -               if(callbackErrorHandler != null)
  +               if(callbackErrorHandler == null)
                  {
  +                  // no callback handler, rethrowing the exception
  +                  throw ex;
  +               }
  +
                     if (trace) { log.trace(this + " handing the error over to " + callbackErrorHandler); }
  +
  +               // a well behaved callback error handler will perform clean up and then rethrow the
  +               // exception so the client application has a chance to find out about the error
  +               // condition
                     callbackErrorHandler.handleError(ex);
                  }
  -               else
  -               {
  -                  log.debug("Error dispatching callback to handler", ex);
  -                  throw new HandleCallbackException("Error dispatching callback to handler", ex);
  -               }
  -            }
            }
         }
         catch(Throwable t)
  
  
  



More information about the jboss-cvs-commits mailing list