Last active
August 29, 2015 14:05
-
-
Save galderz/257e1f39f2dce672cca8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sample; | |
import java.io.Serializable; | |
import org.infinispan.notifications.cachelistener.filter.*; | |
import org.infinispan.metadata.*; | |
@NamedFactory(name = "basic-filter-factory") | |
public class BasicKeyValueFilterFactory implements CacheEventFilterFactory { | |
@Override public CacheEventFilter<Integer, String> getFilter(final Object[] params) { | |
return new BasicKeyValueFilter(params); | |
} | |
static class BasicKeyValueFilter implements CacheEventFilter<Integer, String>, Serializable { | |
private final Object[] params; | |
public BasicKeyValueFilter(Object[] params) { this.params = params; } | |
@Override public boolean accept(Integer key, String oldValue, Metadata oldMetadata, | |
String newValue, Metadata newMetadata, EventType eventType) { | |
return !params[0].equals(key); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment