}
public void handle(ExecutionImpl execution, Exception exception) {
if (isTransactional) {
Environment environment = Environment.getCurrent();
Transaction transaction = (environment!=null ? environment.getTransaction() : null);
if (transaction!=null) {
log.finest("registering exception handler to "+transaction);
AfterTxCompletionListener afterTxCompletionListener = new AfterTxCompletionListener(
execution,
exception,
environment.getEnvironmentFactory()
);
transaction.addListener(afterTxCompletionListener, Transaction.EVENT_AFTERCOMPLETION);
log.finest("registering exception handler to "+transaction);
throw new PvmException("transaction exception handler registered handler after transaction completed. make sure this transaction is rolled back", exception);
} else {
throw new PvmException("no transaction present in the environment for transactional exception handler", exception);
}