for (ObserverMethod<? super Object> observer : observers)
{
try
{
TransactionPhase phase = observer.getTransactionPhase();
if (transaction != null && phase != null)
{
if (phase.equals(TransactionPhase.AFTER_COMPLETION))
{
transaction.registerSynchronization(new AfterCompletion(observer, event));
}
else if (phase.equals(TransactionPhase.AFTER_SUCCESS))
{
transaction.registerSynchronization(new AfterCompletionSuccess(observer, event));
}
else if (phase.equals(TransactionPhase.AFTER_FAILURE))
{
transaction.registerSynchronization(new AfterCompletionFailure(observer, event));
}
else if (phase.equals(TransactionPhase.BEFORE_COMPLETION))
{
transaction.registerSynchronization(new BeforeCompletion(observer, event));
}
else
{