public class MapEventOutput<K,V> extends org.glassfish.jersey.media.sse.EventOutput implements MapListener<K,V>
MapListener implementation that converts Coherence MapEvents
into Jersey Server Sent Events (SSE).| Constructor and Description |
|---|
MapEventOutput(NamedCache<K,V> cache,
boolean fLite)
Construct MapEventOutput instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected org.glassfish.jersey.media.sse.OutboundEvent |
createEvent(String sName,
MapEvent<? extends K,? extends V> evt)
Convert MapEvent to JSON-based OutboundEvent that can be sent to the client.
|
void |
entryDeleted(MapEvent<K,V> evt)
Invoked when a map entry has been removed.
|
void |
entryInserted(MapEvent<K,V> evt)
Invoked when a map entry has been inserted.
|
void |
entryUpdated(MapEvent<K,V> evt)
Invoked when a map entry has been updated.
|
void |
register()
Register this listener.
|
MapEventOutput |
setFilter(Filter filter)
Set the filter to listen on.
|
MapEventOutput |
setKey(K key)
Set the key to listen on.
|
String |
toString() |
protected void |
unregister()
Unregister this listener.
|
protected void |
writeEvent(String sName,
MapEvent<? extends K,? extends V> evt)
Write single event to this EventOutput.
|
equals, hashCode, isClosed, writeclone, finalize, getClass, notify, notifyAll, wait, wait, waitsynchronouspublic MapEventOutput(NamedCache<K,V> cache, boolean fLite)
cache - the cache to register listener withfLite - the flag specifying whether to use lite eventspublic MapEventOutput setFilter(Filter filter)
filter - the filter to listen onpublic MapEventOutput setKey(K key)
key - the key to listen onpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class org.glassfish.jersey.server.ChunkedOutput<org.glassfish.jersey.media.sse.OutboundEvent>IOExceptionpublic void entryInserted(MapEvent<K,V> evt)
MapListenerentryInserted in interface MapListener<K,V>evt - the MapEvent carrying the insert informationpublic void entryUpdated(MapEvent<K,V> evt)
MapListenerentryUpdated in interface MapListener<K,V>evt - the MapEvent carrying the update informationpublic void entryDeleted(MapEvent<K,V> evt)
MapListenerentryDeleted in interface MapListener<K,V>evt - the MapEvent carrying the delete informationpublic void register()
protected void unregister()
protected void writeEvent(String sName, MapEvent<? extends K,? extends V> evt)
sName - the event nameevt - the event to writeprotected org.glassfish.jersey.media.sse.OutboundEvent createEvent(String sName, MapEvent<? extends K,? extends V> evt)
sName - the event nameevt - the MapEvent to convertpublic String toString()
toString in class org.glassfish.jersey.server.ChunkedOutput<org.glassfish.jersey.media.sse.OutboundEvent>