geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@coredevelopers.net>
Subject Re: InvocationResult
Date Sun, 24 Aug 2003 15:23:31 GMT
I should have looked at it more before sending the email.  The code 
should be.

   boolean threwSystemException = true;
   try {
     InvocationResult result = getNext().invoke(invocation);
     threwSystemException = false;
     return result;
   } catch (ApplicationException e) {
     threwSystemException = false;
     throw e;
   } finally {
     EJBInvocationUtil.putEnterpriseContext(invocation, null);
     if (threwSystemException) {
       // invocation threw a system exception so the pool
       // needs to dispose of the context
       pool.remove(ctx);
     } else {
       // return the context to the pool
       pool.release(ctx);
     }
   }

The code I wrote in the last message for callback was wrong because it 
would include all RuntimeExceptions, Errors, and RemoteException in the 
ApplicationException which is wrong, but you can easily picture the 
changes.

I assume you goal it to make code more readable, and I don't think 
hiding an exception in the invocation is the right thing.  That is the 
old C style coding which I hated.  Every time you call something you 
have to write 'if result is an error condition, do something special'.  
Also, there are only a few special interceptors that need to make the 
distinction between application and system exceptions.

-dain

/*************************
  * Dain Sundstrom
  * Partner
  * Core Developers Network
  *************************/


Mime
View raw message