Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] catching container managed transactions

Hi

I have a message driven bean which, inherently, throws an exception back to the container to rollback jms messsages.

I want to be able to catch this exception, log something, and then let the exception carry on.

I have a pointcut defined as follows:

pointcut handleException(Message m): 
call (* myBean.onMessage(Message)) && args(m);

With the advice being:

void around(Message m) throws Exception: handleException(m)
{
try
{
proceed(m);
}
catch(Exception e)
{
System.out.println("Error here,guv "+e);
throw e;
}
}


My question is two-fold:
1) Can we throw the exception like this and will the throw go back to the container managed transaction??
2)  Is this the right way to do this kind of thing? (im assuming not, as the advice is marked as 'Not matched', but maybe this is one for the ajdt guys.)

Sorry - im completely new to this stuff....

Regards,
Andy


Back to the top