org.atmosphere.cpr
Class DefaultBroadcaster

java.lang.Object
  extended by org.atmosphere.cpr.DefaultBroadcaster
All Implemented Interfaces:
Broadcaster
Direct Known Subclasses:
AbstractBroadcasterProxy, ExcludeSessionBroadcaster, SimpleBroadcaster

public class DefaultBroadcaster
extends Object
implements Broadcaster

The default Broadcaster implementation.

Broadcast messages to suspended responses using the caller's Thread. This basic Broadcaster use an ExecutorService to broadcast messages, hence the broadcast operation is asynchronous. Make sure you block on broadcast(Object).get()} if you need synchronous operations.

Author:
Jeanfrancois Arcand

Nested Class Summary
protected static class DefaultBroadcaster.AsyncWriteToken
           
 
Nested classes/interfaces inherited from interface org.atmosphere.cpr.Broadcaster
Broadcaster.POLICY, Broadcaster.SCOPE
 
Field Summary
static String ASYNC_TOKEN
           
protected  Future<?>[] asyncWriteFuture
           
protected  BroadcasterConfig bc
           
protected  ConcurrentLinkedQueue<BroadcasterListener> broadcasterListeners
           
protected  ConcurrentLinkedQueue<Entry> broadcastOnResume
           
static String CACHED
           
protected  AtmosphereConfig config
           
protected  ConcurrentLinkedQueue<Entry> delayedBroadcast
           
protected  AtomicBoolean destroyed
           
protected  AtomicInteger dispatchThread
           
protected  ConcurrentLinkedQueue<BroadcasterLifeCyclePolicyListener> lifeCycleListeners
           
protected  BlockingQueue<Entry> messages
           
protected  String name
           
protected  AtmosphereResource noOpsResource
           
protected  Future<?>[] notifierFuture
           
static int POLLING_DEFAULT
           
protected  ConcurrentLinkedQueue<AtmosphereResource> resources
           
protected  Broadcaster.SCOPE scope
           
protected  AtomicBoolean started
           
protected  org.atmosphere.cpr.DefaultBroadcaster.WriteQueue uniqueWriteQueue
           
protected  URI uri
           
protected  int waitTime
           
protected  ConcurrentHashMap<String,org.atmosphere.cpr.DefaultBroadcaster.WriteQueue> writeQueues
           
protected  int writeTimeoutInSecond
           
 
Constructor Summary
DefaultBroadcaster(String name, AtmosphereConfig config)
           
DefaultBroadcaster(String name, URI uri, AtmosphereConfig config)
           
 
Method Summary
 Broadcaster addAtmosphereResource(AtmosphereResource r)
          Add a AtmosphereResource to the list of items to be notified when the Broadcaster.broadcast(java.lang.Object) is invoked.
 void addBroadcasterLifeCyclePolicyListener(BroadcasterLifeCyclePolicyListener b)
          Add a BroadcasterLifeCyclePolicyListener.
 Broadcaster addBroadcasterListener(BroadcasterListener b)
          Add a BroadcasterListener.
 Future<Object> awaitAndBroadcast(Object t, long time, TimeUnit timeUnit)
          Await for available AtmosphereResource before broadcasting.
 Future<Object> broadcast(Object msg)
          Broadcast the Object to all suspended responses, eg.
 Future<Object> broadcast(Object msg, AtmosphereResource r)
          Broadcast the Object to all suspended responses, eg.
 Future<Object> broadcast(Object msg, Set<AtmosphereResource> subset)
          Broadcast the Object to all suspended response, eg.
protected  void broadcastOnResume(AtmosphereResource r)
           
 Future<Object> broadcastOnResume(Object msg)
          Broadcast the Object when an AtmosphereResource is resumed by a timeout or when using AtmosphereResource.resume().
protected  void cacheAndSuspend(AtmosphereResource r)
          Look in the cache to see if there are messages available, and take the appropriate actions.
 void cacheLostMessage(AtmosphereResource r)
          Cache the message because an unexpected exception occurred.
 void cacheLostMessage(AtmosphereResource r, boolean force)
          Cache the message because an unexpected exception occurred.
 void cacheLostMessage(AtmosphereResource r, DefaultBroadcaster.AsyncWriteToken token)
          Cache the message because an unexpected exception occurred.
 void cacheLostMessage(AtmosphereResource r, DefaultBroadcaster.AsyncWriteToken token, boolean force)
          Cache the message because an unexpected exception occurred.
protected  boolean checkCachedAndPush(AtmosphereResource r, AtmosphereResourceEvent e)
           
protected  BroadcasterConfig createBroadcasterConfig(AtmosphereConfig config)
          Create BroadcasterConfig.
 Future<Object> delayBroadcast(Object o)
          Delay the broadcast operation.
 Future<Object> delayBroadcast(Object o, long delay, TimeUnit t)
          Delay the broadcast operation.
protected  void deliverPush(Entry entry, boolean rec)
           
 void destroy()
          Destroy this instance and shutdown it's associated ExecutorService.
protected  void dispatchMessages(Entry e)
           
protected  void entryDone(BroadcasterFuture<?> f)
           
protected  void executeAsyncWrite(DefaultBroadcaster.AsyncWriteToken token)
           
protected  void executeBlockingWrite(AtmosphereResource r, Entry entry)
           
protected  Object filter(Object msg)
          Invoke the BroadcastFilter
protected  BroadcasterFuture<Object> futureDone(Object msg)
           
protected  Runnable getAsyncWriteHandler(org.atmosphere.cpr.DefaultBroadcaster.WriteQueue writeQueue)
           
 Collection<AtmosphereResource> getAtmosphereResources()
          Return an List of AtmosphereResource.
 BroadcasterConfig getBroadcasterConfig()
          Return the current BroadcasterConfig.
protected  Runnable getBroadcastHandler()
           
 String getID()
          Return the ID of this Broadcaster.
 Broadcaster.SCOPE getScope()
          Return the Broadcaster.SCOPE.
protected  void invokeOnStateChange(AtmosphereResource r, AtmosphereResourceEvent e)
           
 boolean isDestroyed()
          Return true if this Broadcaster has been destroyed.
protected  void killReactiveThreads()
           
protected  void notifyAndAdd(AtmosphereResource r)
           
protected  void notifyBroadcastListener()
           
protected  void notifyDestroyListener()
           
protected  void notifyEmptyListener()
           
protected  void notifyIdleListener()
           
protected  void notifyOnAddAtmosphereResourceListener(AtmosphereResource r)
           
protected  void notifyOnRemoveAtmosphereResourceListener(AtmosphereResource r)
           
 void onException(Throwable t, AtmosphereResource ar)
           
 void onException(Throwable t, AtmosphereResource ar, boolean notifyAndCache)
           
protected  boolean perRequestFilter(AtmosphereResource r, Entry msg)
           
protected  void prepareInvokeOnStateChange(AtmosphereResource r, AtmosphereResourceEvent e)
           
protected  void push(Entry entry)
           
protected  void queueWriteIO(AtmosphereResource r, Entry entry)
           
protected  int reactiveThreadsCount()
          Return the default number of reactive threads that will be waiting for work when a broadcast operation is executed.
 void releaseExternalResources()
          Release external resources associated with this Broadcaster.
 Broadcaster removeAtmosphereResource(AtmosphereResource r)
          Remove a AtmosphereResource from the list of s to be notified when the Broadcaster.broadcast(java.lang.Object) is invoked.
protected  Broadcaster removeAtmosphereResource(AtmosphereResource r, boolean executeDone)
           
 void removeBroadcasterLifeCyclePolicyListener(BroadcasterLifeCyclePolicyListener b)
          Remove a BroadcasterLifeCyclePolicyListener.
 Broadcaster removeBroadcasterListener(BroadcasterListener b)
          Remove a BroadcasterListener.
 void resumeAll()
          Resume all suspended responses (AtmosphereResource) added via Broadcaster.addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource).
protected  boolean retrieveTrackedBroadcast(AtmosphereResource r, AtmosphereResourceEvent e)
           
 Future<Object> scheduleFixedBroadcast(Object o, long waitFor, long period, TimeUnit t)
          Broadcast periodically.
 Future<Object> scheduleFixedBroadcast(Object o, long period, TimeUnit t)
          Broadcast periodically.
 void setBroadcasterConfig(BroadcasterConfig bc)
          Set the BroadcasterConfig instance.
 void setBroadcasterLifeCyclePolicy(BroadcasterLifeCyclePolicy lifeCyclePolicy)
          Set the BroadcasterLifeCyclePolicy.
 void setID(String id)
          Set the ID of this Broadcaster.
 void setScope(Broadcaster.SCOPE scope)
          Set the scope.
 void setSuspendPolicy(long maxSuspendResource, Broadcaster.POLICY policy)
          Set the maximum number of suspended AtmosphereResources.
protected  void spawnReactor()
           
protected  void start()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POLLING_DEFAULT

public static final int POLLING_DEFAULT
See Also:
Constant Field Values

CACHED

public static final String CACHED

ASYNC_TOKEN

public static final String ASYNC_TOKEN

resources

protected final ConcurrentLinkedQueue<AtmosphereResource> resources

bc

protected BroadcasterConfig bc

messages

protected final BlockingQueue<Entry> messages

broadcasterListeners

protected final ConcurrentLinkedQueue<BroadcasterListener> broadcasterListeners

started

protected final AtomicBoolean started

destroyed

protected final AtomicBoolean destroyed

scope

protected Broadcaster.SCOPE scope

name

protected String name

delayedBroadcast

protected final ConcurrentLinkedQueue<Entry> delayedBroadcast

broadcastOnResume

protected final ConcurrentLinkedQueue<Entry> broadcastOnResume

lifeCycleListeners

protected final ConcurrentLinkedQueue<BroadcasterLifeCyclePolicyListener> lifeCycleListeners

writeQueues

protected final ConcurrentHashMap<String,org.atmosphere.cpr.DefaultBroadcaster.WriteQueue> writeQueues

uniqueWriteQueue

protected final org.atmosphere.cpr.DefaultBroadcaster.WriteQueue uniqueWriteQueue

dispatchThread

protected final AtomicInteger dispatchThread

notifierFuture

protected Future<?>[] notifierFuture

asyncWriteFuture

protected Future<?>[] asyncWriteFuture

uri

protected URI uri

config

protected AtmosphereConfig config

writeTimeoutInSecond

protected int writeTimeoutInSecond

noOpsResource

protected final AtmosphereResource noOpsResource

waitTime

protected int waitTime
Constructor Detail

DefaultBroadcaster

public DefaultBroadcaster(String name,
                          URI uri,
                          AtmosphereConfig config)

DefaultBroadcaster

public DefaultBroadcaster(String name,
                          AtmosphereConfig config)
Method Detail

createBroadcasterConfig

protected BroadcasterConfig createBroadcasterConfig(AtmosphereConfig config)
Create BroadcasterConfig.

Parameters:
config - the AtmosphereConfig
Returns:
an instance of BroadcasterConfig

destroy

public void destroy()
Description copied from interface: Broadcaster
Destroy this instance and shutdown it's associated ExecutorService.

Specified by:
destroy in interface Broadcaster

getAtmosphereResources

public Collection<AtmosphereResource> getAtmosphereResources()
Description copied from interface: Broadcaster
Return an List of AtmosphereResource.

Specified by:
getAtmosphereResources in interface Broadcaster
Returns:
List of AtmosphereResource associated with this Broadcaster.
See Also:
Broadcaster.addAtmosphereResource(AtmosphereResource)

setScope

public void setScope(Broadcaster.SCOPE scope)
Description copied from interface: Broadcaster
Set the scope.

Specified by:
setScope in interface Broadcaster
Parameters:
scope - Broadcaster.SCOPE to set.

getScope

public Broadcaster.SCOPE getScope()
Description copied from interface: Broadcaster
Return the Broadcaster.SCOPE.

Specified by:
getScope in interface Broadcaster
Returns:
Broadcaster.SCOPE of Broadcaster.

setID

public void setID(String id)
Description copied from interface: Broadcaster
Set the ID of this Broadcaster.

Specified by:
setID in interface Broadcaster
Parameters:
id - ID of this Broadcaster

getID

public String getID()
Description copied from interface: Broadcaster
Return the ID of this Broadcaster.

Specified by:
getID in interface Broadcaster
Returns:
the ID of this Broadcaster

resumeAll

public void resumeAll()
Description copied from interface: Broadcaster
Resume all suspended responses (AtmosphereResource) added via Broadcaster.addAtmosphereResource(org.atmosphere.cpr.AtmosphereResource).

Specified by:
resumeAll in interface Broadcaster

releaseExternalResources

public void releaseExternalResources()
Description copied from interface: Broadcaster
Release external resources associated with this Broadcaster. This is useful when a Broadcaster no longer have suspended AtmosphereResource and some resource (like database connections, JMS queue, etc.) needs to be closed.

Specified by:
releaseExternalResources in interface Broadcaster

setBroadcasterLifeCyclePolicy

public void setBroadcasterLifeCyclePolicy(BroadcasterLifeCyclePolicy lifeCyclePolicy)
Description copied from interface: Broadcaster
Set the BroadcasterLifeCyclePolicy. Make sure you are selecting the right policy to avoid unexpected situations.

Specified by:
setBroadcasterLifeCyclePolicy in interface Broadcaster
Parameters:
lifeCyclePolicy - a BroadcasterLifeCyclePolicy

addBroadcasterLifeCyclePolicyListener

public void addBroadcasterLifeCyclePolicyListener(BroadcasterLifeCyclePolicyListener b)
Description copied from interface: Broadcaster
Add a BroadcasterLifeCyclePolicyListener.

Specified by:
addBroadcasterLifeCyclePolicyListener in interface Broadcaster
Parameters:
b - a BroadcasterLifeCyclePolicyListener

removeBroadcasterLifeCyclePolicyListener

public void removeBroadcasterLifeCyclePolicyListener(BroadcasterLifeCyclePolicyListener b)
Description copied from interface: Broadcaster
Remove a BroadcasterLifeCyclePolicyListener.

Specified by:
removeBroadcasterLifeCyclePolicyListener in interface Broadcaster
Parameters:
b - a BroadcasterLifeCyclePolicyListener

isDestroyed

public boolean isDestroyed()
Description copied from interface: Broadcaster
Return true if this Broadcaster has been destroyed.

Specified by:
isDestroyed in interface Broadcaster
Returns:
true if this Broadcaster has been destroyed

awaitAndBroadcast

public Future<Object> awaitAndBroadcast(Object t,
                                        long time,
                                        TimeUnit timeUnit)
Description copied from interface: Broadcaster
Await for available AtmosphereResource before broadcasting. This method will block until Broadcaster.addAtmosphereResource(AtmosphereResource) gets invoked.

Specified by:
awaitAndBroadcast in interface Broadcaster

addBroadcasterListener

public Broadcaster addBroadcasterListener(BroadcasterListener b)
Description copied from interface: Broadcaster
Add a BroadcasterListener.

Specified by:
addBroadcasterListener in interface Broadcaster
Parameters:
b - a BroadcasterListener
Returns:
this

removeBroadcasterListener

public Broadcaster removeBroadcasterListener(BroadcasterListener b)
Description copied from interface: Broadcaster
Remove a BroadcasterListener.

Specified by:
removeBroadcasterListener in interface Broadcaster
Parameters:
b - a BroadcasterListener
Returns:
this

getBroadcastHandler

protected Runnable getBroadcastHandler()

getAsyncWriteHandler

protected Runnable getAsyncWriteHandler(org.atmosphere.cpr.DefaultBroadcaster.WriteQueue writeQueue)

start

protected void start()

spawnReactor

protected void spawnReactor()

killReactiveThreads

protected void killReactiveThreads()

reactiveThreadsCount

protected int reactiveThreadsCount()
Return the default number of reactive threads that will be waiting for work when a broadcast operation is executed.

Returns:
the default number of reactive threads

push

protected void push(Entry entry)

deliverPush

protected void deliverPush(Entry entry,
                           boolean rec)

queueWriteIO

protected void queueWriteIO(AtmosphereResource r,
                            Entry entry)
                     throws InterruptedException
Throws:
InterruptedException

executeBlockingWrite

protected void executeBlockingWrite(AtmosphereResource r,
                                    Entry entry)
                             throws InterruptedException
Throws:
InterruptedException

perRequestFilter

protected boolean perRequestFilter(AtmosphereResource r,
                                   Entry msg)

executeAsyncWrite

protected void executeAsyncWrite(DefaultBroadcaster.AsyncWriteToken token)

checkCachedAndPush

protected boolean checkCachedAndPush(AtmosphereResource r,
                                     AtmosphereResourceEvent e)

retrieveTrackedBroadcast

protected boolean retrieveTrackedBroadcast(AtmosphereResource r,
                                           AtmosphereResourceEvent e)

invokeOnStateChange

protected void invokeOnStateChange(AtmosphereResource r,
                                   AtmosphereResourceEvent e)

prepareInvokeOnStateChange

protected void prepareInvokeOnStateChange(AtmosphereResource r,
                                          AtmosphereResourceEvent e)

onException

public void onException(Throwable t,
                        AtmosphereResource ar)

onException

public void onException(Throwable t,
                        AtmosphereResource ar,
                        boolean notifyAndCache)

cacheLostMessage

public void cacheLostMessage(AtmosphereResource r)
Cache the message because an unexpected exception occurred.

Parameters:
r - AtmosphereResource

cacheLostMessage

public void cacheLostMessage(AtmosphereResource r,
                             boolean force)
Cache the message because an unexpected exception occurred.

Parameters:
r - AtmosphereResource

cacheLostMessage

public void cacheLostMessage(AtmosphereResource r,
                             DefaultBroadcaster.AsyncWriteToken token)
Cache the message because an unexpected exception occurred.

Parameters:
r - AtmosphereResource

cacheLostMessage

public void cacheLostMessage(AtmosphereResource r,
                             DefaultBroadcaster.AsyncWriteToken token,
                             boolean force)
Cache the message because an unexpected exception occurred.

Parameters:
r - AtmosphereResource

setSuspendPolicy

public void setSuspendPolicy(long maxSuspendResource,
                             Broadcaster.POLICY policy)
Description copied from interface: Broadcaster
Set the maximum number of suspended AtmosphereResources. If the maximum is reached, Atmosphere will either resume AtmosphereResource using Broadcaster.POLICY.FIFO (first in first out) or Broadcaster.POLICY.REJECT the AtmosphereResource.

By default the number is unlimited.

Specified by:
setSuspendPolicy in interface Broadcaster
Parameters:
maxSuspendResource - maximum number of suspended AtmosphereResource

broadcast

public Future<Object> broadcast(Object msg)
Description copied from interface: Broadcaster
Broadcast the Object to all suspended responses, eg. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent).

Specified by:
broadcast in interface Broadcaster
Parameters:
msg - the Object to be broadcasted
Returns:
a Future that can be used to synchronize using the Future.get()

futureDone

protected BroadcasterFuture<Object> futureDone(Object msg)

dispatchMessages

protected void dispatchMessages(Entry e)

filter

protected Object filter(Object msg)
Invoke the BroadcastFilter

Parameters:
msg -
Returns:

broadcast

public Future<Object> broadcast(Object msg,
                                AtmosphereResource r)
Description copied from interface: Broadcaster
Broadcast the Object to all suspended responses, eg. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with an instance of AtmosphereResource, representing a single suspended response.

Specified by:
broadcast in interface Broadcaster
Parameters:
msg - the Object to be broadcasted
r - an AtmosphereResource
Returns:
a Future that can be used to synchronize using the Future.get()

broadcastOnResume

public Future<Object> broadcastOnResume(Object msg)
Description copied from interface: Broadcaster
Broadcast the Object when an AtmosphereResource is resumed by a timeout or when using AtmosphereResource.resume().

Specified by:
broadcastOnResume in interface Broadcaster
Parameters:
msg - the Object to be broadcasted
Returns:
a Future that can be used to synchronize using the Future.get()

broadcastOnResume

protected void broadcastOnResume(AtmosphereResource r)

broadcast

public Future<Object> broadcast(Object msg,
                                Set<AtmosphereResource> subset)
Description copied from interface: Broadcaster
Broadcast the Object to all suspended response, eg. invoke AtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) with a Set of AtmosphereResource, representing a set of AtmosphereHandler.

Specified by:
broadcast in interface Broadcaster
Parameters:
msg - the Object to be broadcasted
subset - a Set of AtmosphereResource
Returns:
a Future that can be used to synchronize using the Future.get()

addAtmosphereResource

public Broadcaster addAtmosphereResource(AtmosphereResource r)
Description copied from interface: Broadcaster
Add a AtmosphereResource to the list of items to be notified when the Broadcaster.broadcast(java.lang.Object) is invoked.

It is strongly recommended to suspend the AtmosphereResource before adding it to a Broadcaster.

Specified by:
addAtmosphereResource in interface Broadcaster
Parameters:
r - an AtmosphereResource
Returns:
this

cacheAndSuspend

protected void cacheAndSuspend(AtmosphereResource r)
Look in the cache to see if there are messages available, and take the appropriate actions.

Parameters:
r - AtmosphereResource

notifyAndAdd

protected void notifyAndAdd(AtmosphereResource r)

entryDone

protected void entryDone(BroadcasterFuture<?> f)

notifyBroadcastListener

protected void notifyBroadcastListener()

notifyOnAddAtmosphereResourceListener

protected void notifyOnAddAtmosphereResourceListener(AtmosphereResource r)

notifyOnRemoveAtmosphereResourceListener

protected void notifyOnRemoveAtmosphereResourceListener(AtmosphereResource r)

removeAtmosphereResource

public Broadcaster removeAtmosphereResource(AtmosphereResource r)
Description copied from interface: Broadcaster
Remove a AtmosphereResource from the list of s to be notified when the Broadcaster.broadcast(java.lang.Object) is invoked.

Specified by:
removeAtmosphereResource in interface Broadcaster
Parameters:
r - an AtmosphereResource
Returns:
this

removeAtmosphereResource

protected Broadcaster removeAtmosphereResource(AtmosphereResource r,
                                               boolean executeDone)

notifyIdleListener

protected void notifyIdleListener()

notifyDestroyListener

protected void notifyDestroyListener()

notifyEmptyListener

protected void notifyEmptyListener()

setBroadcasterConfig

public void setBroadcasterConfig(BroadcasterConfig bc)
Description copied from interface: Broadcaster
Set the BroadcasterConfig instance.

Specified by:
setBroadcasterConfig in interface Broadcaster
Parameters:
bc - Configuration to be set.

getBroadcasterConfig

public BroadcasterConfig getBroadcasterConfig()
Description copied from interface: Broadcaster
Return the current BroadcasterConfig.

Specified by:
getBroadcasterConfig in interface Broadcaster
Returns:
the current BroadcasterConfig

delayBroadcast

public Future<Object> delayBroadcast(Object o)
Description copied from interface: Broadcaster
Delay the broadcast operation. The Object will be broadcasted when Broadcaster.broadcast(java.lang.Object) is invoked the first time.

Specified by:
delayBroadcast in interface Broadcaster
Parameters:
o - the Object to be broadcasted
Returns:
a Future that can be used to synchronize using the Future.get()

delayBroadcast

public Future<Object> delayBroadcast(Object o,
                                     long delay,
                                     TimeUnit t)
Description copied from interface: Broadcaster
Delay the broadcast operation. The Object will be broadcasted once the specified delay expires or when Broadcaster.broadcast(java.lang.Object) is invoked the first time.

Specified by:
delayBroadcast in interface Broadcaster
Parameters:
o - the Object to be broadcasted
delay - Amount of time to delay
t - the TimeUnit of the delay
Returns:
a Future that can be used to synchronize using the Future.get()

scheduleFixedBroadcast

public Future<Object> scheduleFixedBroadcast(Object o,
                                             long period,
                                             TimeUnit t)
Description copied from interface: Broadcaster
Broadcast periodically. The Object will be broadcasted after every period specified time frame expires. If the TimeUnit is set to null, the Object will be broadcasted when the first Broadcaster.broadcast(java.lang.Object) is invoked.

Specified by:
scheduleFixedBroadcast in interface Broadcaster
Parameters:
o - the Object to be broadcasted
period - Every so often broadcast.
t - a TimeUnit of period.
Returns:
a Future that can be used to synchronize using the Future.get()

scheduleFixedBroadcast

public Future<Object> scheduleFixedBroadcast(Object o,
                                             long waitFor,
                                             long period,
                                             TimeUnit t)
Description copied from interface: Broadcaster
Broadcast periodically. The Object will be broadcasted after every period specified time frame expires. If the TimeUnit is set null, the Object will be broadcasted when the first Broadcaster.broadcast(java.lang.Object) is invoked.

Specified by:
scheduleFixedBroadcast in interface Broadcaster
Parameters:
o - the Object to be broadcasted
waitFor - Wait for that long before first broadcast
period - The period inbetween broadcast.
t - a TimeUnit of waitFor and period.
Returns:
a Future that can be used to synchronize using the Future.get()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.