Skip to content

Commit

Permalink
Use extracted attributes instead of annotation access
Browse files Browse the repository at this point in the history
See gh-31034

(cherry picked from commit d781f29)
  • Loading branch information
jhoeller committed Aug 12, 2023
1 parent bb46b31 commit 2b48254
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -48,10 +48,10 @@
public class TransactionalApplicationListenerMethodAdapter extends ApplicationListenerMethodAdapter
implements TransactionalApplicationListener<ApplicationEvent> {

private final TransactionalEventListener annotation;

private final TransactionPhase transactionPhase;

private final boolean fallbackExecution;

private final List<SynchronizationCallback> callbacks = new CopyOnWriteArrayList<>();


Expand All @@ -68,8 +68,8 @@ public TransactionalApplicationListenerMethodAdapter(String beanName, Class<?> t
if (eventAnn == null) {
throw new IllegalStateException("No TransactionalEventListener annotation found on method: " + method);
}
this.annotation = eventAnn;
this.transactionPhase = eventAnn.phase();
this.fallbackExecution = eventAnn.fallbackExecution();
}


Expand All @@ -92,8 +92,8 @@ public void onApplicationEvent(ApplicationEvent event) {
TransactionSynchronizationManager.registerSynchronization(
new TransactionalApplicationListenerSynchronization<>(event, this, this.callbacks));
}
else if (this.annotation.fallbackExecution()) {
if (this.annotation.phase() == TransactionPhase.AFTER_ROLLBACK && logger.isWarnEnabled()) {
else if (this.fallbackExecution) {
if (getTransactionPhase() == TransactionPhase.AFTER_ROLLBACK && logger.isWarnEnabled()) {
logger.warn("Processing " + event + " as a fallback execution on AFTER_ROLLBACK phase");
}
processEvent(event);
Expand Down

0 comments on commit 2b48254

Please sign in to comment.