org.glassfish.jersey.media.sse
Class SseBroadcaster

java.lang.Object
  extended by org.glassfish.jersey.server.Broadcaster<OutboundEvent>
      extended by org.glassfish.jersey.media.sse.SseBroadcaster
All Implemented Interfaces:
BroadcasterListener<OutboundEvent>

public class SseBroadcaster
extends Broadcaster<OutboundEvent>

Used for broadcasting SSE to multiple EventOutput instances.

Author:
Pavel Bucek (pavel.bucek at oracle.com), Martin Matula (martin.matula at oracle.com)

Constructor Summary
  SseBroadcaster()
          Creates a new instance.
protected SseBroadcaster(java.lang.Class<? extends SseBroadcaster> subclass)
          Can be used by subclasses to override the default functionality of adding self to the set of listeners.
 
Method Summary
 void add(EventOutput eventOutput)
          Register EventOutput to current SseBroadcaster instance.
 
Methods inherited from class org.glassfish.jersey.server.Broadcaster
add, addBroadcasterListener, broadcast, closeAll, onClose, onException, remove, removeBroadcasterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SseBroadcaster

public SseBroadcaster()
Creates a new instance. If this constructor is called by a subclass, it assumes the the reason for the subclass to exist is to implement Broadcaster.onClose(org.glassfish.jersey.server.ChunkedOutput) and Broadcaster.onException(org.glassfish.jersey.server.ChunkedOutput, Exception) methods, so it adds the newly created instance as the listener. To avoid this, subclasses may call SseBroadcaster(Class) passing their class as an argument.


SseBroadcaster

protected SseBroadcaster(java.lang.Class<? extends SseBroadcaster> subclass)
Can be used by subclasses to override the default functionality of adding self to the set of listeners. If creating a direct instance of a subclass passed in the parameter, the broadcaster will not register itself as a listener.

Parameters:
subclass - subclass of SseBroadcaster that should not be registered as a listener - if creating a direct instance of this subclass, this constructor will not register the new instance as a listener.
See Also:
SseBroadcaster()
Method Detail

add

public void add(EventOutput eventOutput)
Register EventOutput to current SseBroadcaster instance.

Parameters:
eventOutput - EventOutput to register. TODO is this needed? Should we instead override the Broadcaster.add and make it's argument generic?


Copyright © 2007-2013 Oracle Corporation. All Rights Reserved. Use is subject to license terms.