Hello,

I was looking through the EventHandlerUtil class and found that some
code looks a bit strange to me.

For example lets look at methodException() method.

=================================
EventCartridge ev1 = rsvc.getApplicationEventCartridge();

// skipped
        
if (ev1 != null)
  for (Iterator i = ev1.getMethodExceptionEventHandlers(); i.hasNext();)
  {
    MethodExceptionEventHandler eh = (MethodExceptionEventHandler) i.next();
    if (eh instanceof ContextAware)
      ((ContextAware) eh).setContext(context);
    return eh.methodException(claz, method, e);
  }
=================================

I think that ContextAware check for _application_ event handlers is
useless in the multithreaded applications.

There is no synchronization used, so handler can get "context" from
one thread and "claz,method,e" from the another thread.

So, at least, for application event handlers the ContextAware lines
should be removed.

If somebody wants context in application event handlers - the correct
way to go is to introduce another interface (for example
MethodExceptionEventHandler2) with new method, for example
methodException(context, claz, method, e);

What do you think ?

-- 
Best regards,
 Alexey                          mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to