org.multiverse.api
Class Listeners

java.lang.Object
  extended by org.multiverse.api.Listeners

public final class Listeners
extends java.lang.Object

A immutable single-linked list for storing listener-latches.

Structure is thread-safe and designed to be used in a CAS-loop.

Author:
Peter Veentjer.

Constructor Summary
Listeners(Latch listener, Listeners next)
           
 
Method Summary
 Latch getListener()
          Returns the listener Latch stored in this ListenerNode.
 Listeners getNext()
          Gets the next ListenerNode or null if this ListerNode is the end of the line.
 void openAll()
          Opens all listeners.
static void openAll(Listeners[] arrayOfListeners)
          Opens all listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listeners

public Listeners(Latch listener,
                 Listeners next)
Method Detail

getListener

public Latch getListener()
Returns the listener Latch stored in this ListenerNode.

Returns:
the listener Latch.

getNext

public Listeners getNext()
Gets the next ListenerNode or null if this ListerNode is the end of the line.

Returns:
the next ListenerNode

openAll

public void openAll()
Opens all listeners. Method is not recursive but iterative.


openAll

public static void openAll(Listeners[] arrayOfListeners)
Opens all listeners. Stops as soon as it finds a null, and can safely be called with a null listenersArray.

Parameters:
arrayOfListeners - the array of Listeners.


Copyright © 2008-2010 Multiverse. All Rights Reserved.