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, flushQueue, hashCode, isClosed, onClose, write
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
synchronous
public 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 Closeable
close
in interface AutoCloseable
close
in class org.glassfish.jersey.server.ChunkedOutput<org.glassfish.jersey.media.sse.OutboundEvent>
IOException
public void entryInserted(MapEvent<K,V> evt)
MapListener
entryInserted
in interface MapListener<K,V>
evt
- the MapEvent carrying the insert informationpublic void entryUpdated(MapEvent<K,V> evt)
MapListener
entryUpdated
in interface MapListener<K,V>
evt
- the MapEvent carrying the update informationpublic void entryDeleted(MapEvent<K,V> evt)
MapListener
entryDeleted
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>