org.infinispan.cdi.event.cache.TransactionCompletedAdapter Maven / Gradle / Ivy
package org.infinispan.cdi.event.cache;
import org.infinispan.Cache;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.TransactionCompleted;
import org.infinispan.notifications.cachelistener.event.TransactionCompletedEvent;
import org.infinispan.transaction.xa.GlobalTransaction;
import javax.enterprise.event.Event;
import javax.enterprise.util.TypeLiteral;
/**
* Event bridge for {@link org.infinispan.notifications.cachelistener.annotation.TransactionCompleted}.
*
* @author Pete Muir
* @author Sebastian Laskawiec
* @see org.infinispan.notifications.Listener
* @see org.infinispan.notifications.cachelistener.annotation.TransactionCompleted
*/
@Listener
public class TransactionCompletedAdapter extends AbstractAdapter> {
/**
* CDI does not allow parametrized type for events (like
). This is why this wrapped needs to be
* introduced. To ensure type safety, this needs to be linked to parent class (in other words this class can not
* be static).
*/
private class CDITransactionCompletedEvent implements TransactionCompletedEvent {
private TransactionCompletedEvent decoratedEvent;
private CDITransactionCompletedEvent(TransactionCompletedEvent decoratedEvent) {
this.decoratedEvent = decoratedEvent;
}
@Override
public boolean isTransactionSuccessful() {
return decoratedEvent.isTransactionSuccessful();
}
@Override
public GlobalTransaction getGlobalTransaction() {
return decoratedEvent.getGlobalTransaction();
}
@Override
public boolean isOriginLocal() {
return decoratedEvent.isOriginLocal();
}
@Override
public Type getType() {
return decoratedEvent.getType();
}
@Override
public boolean isPre() {
return decoratedEvent.isPre();
}
@Override
public Cache getCache() {
return decoratedEvent.getCache();
}
}
/**
* Needed for creating event bridge.
*/
public static final TransactionCompletedEvent, ?> EMPTY = new TransactionCompletedEvent
© 2015 - 2025 Weber Informatics LLC | Privacy Policy