org.apache.curator.framework.listen
Class ListenerContainer<T>

java.lang.Object
  extended by org.apache.curator.framework.listen.ListenerContainer<T>
All Implemented Interfaces:
Listenable<T>

public class ListenerContainer<T>
extends Object
implements Listenable<T>

Abstracts an object that has listeners


Constructor Summary
ListenerContainer()
           
 
Method Summary
 void addListener(T listener)
          Add the given listener.
 void addListener(T listener, Executor executor)
          Add the given listener.
 void clear()
          Remove all listeners
 void forEach(com.google.common.base.Function<T,Void> function)
          Utility - apply the given function to each listener.
 void removeListener(T listener)
          Remove the given listener
 int size()
          Return the number of listeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerContainer

public ListenerContainer()
Method Detail

addListener

public void addListener(T listener)
Description copied from interface: Listenable
Add the given listener. The listener will be executed in the containing instance's thread.

Specified by:
addListener in interface Listenable<T>
Parameters:
listener - listener to add

addListener

public void addListener(T listener,
                        Executor executor)
Description copied from interface: Listenable
Add the given listener. The listener will be executed using the given executor

Specified by:
addListener in interface Listenable<T>
Parameters:
listener - listener to add
executor - executor to run listener in

removeListener

public void removeListener(T listener)
Description copied from interface: Listenable
Remove the given listener

Specified by:
removeListener in interface Listenable<T>
Parameters:
listener - listener to remove

clear

public void clear()
Remove all listeners


size

public int size()
Return the number of listeners

Returns:
number

forEach

public void forEach(com.google.common.base.Function<T,Void> function)
Utility - apply the given function to each listener. The function receives the listener as an argument.

Parameters:
function - function to call for each listener


Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.