org.infinispan.cdi.event.cache.DataRehashedAdapter Maven / Gradle / Ivy
package org.infinispan.cdi.event.cache;
import org.infinispan.Cache;
import org.infinispan.distribution.ch.ConsistentHash;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.DataRehashed;
import org.infinispan.notifications.cachelistener.event.DataRehashedEvent;
import org.infinispan.remoting.transport.Address;
import javax.enterprise.event.Event;
import javax.enterprise.util.TypeLiteral;
import java.util.Collection;
/**
* Event bridge for {@link org.infinispan.notifications.cachelistener.annotation.DataRehashed}.
*
* @author Pete Muir
* @author Sebastian Laskawiec
* @see org.infinispan.notifications.Listener
* @see org.infinispan.notifications.cachelistener.annotation.DataRehashed
*/
@Listener
public class DataRehashedAdapter 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 CDIDataRehashedEvent implements DataRehashedEvent {
private DataRehashedEvent decoratedEvent;
private CDIDataRehashedEvent(DataRehashedEvent decoratedEvent) {
this.decoratedEvent = decoratedEvent;
}
@Override
public Collection getMembersAtStart() {
return decoratedEvent.getMembersAtStart();
}
@Override
public Collection getMembersAtEnd() {
return decoratedEvent.getMembersAtEnd();
}
@Override
public ConsistentHash getConsistentHashAtStart() {
return decoratedEvent.getConsistentHashAtStart();
}
@Override
public ConsistentHash getConsistentHashAtEnd() {
return decoratedEvent.getConsistentHashAtEnd();
}
@Override
public ConsistentHash getUnionConsistentHash() {
return decoratedEvent.getUnionConsistentHash();
}
@Override
public int getNewTopologyId() {
return decoratedEvent.getNewTopologyId();
}
@Override
public Type getType() {
return decoratedEvent.getType();
}
@Override
public boolean isPre() {
return decoratedEvent.isPre();
}
@Override
public Cache getCache() {
return decoratedEvent.getCache();
}
}
public static final DataRehashedEvent, ?> EMPTY = new DataRehashedEvent
© 2015 - 2025 Weber Informatics LLC | Privacy Policy