com.deltax.util.listener
Interface IListenerSupport

All Known Implementing Classes:
ListenerSupport

public interface IListenerSupport

An interface for the ListenerSupport class (experimental).

Version:
1.0
Author:
Cristiano Sadun

Method Summary
 void addListener(Listener listener)
          Add a listener to the listeners set.
 int countListeners()
          Count the registered listeners.
 long getReceiveTimeout()
          Return the the amount of time(in ms.) a Listeneris given to exit gracefully from the Listener.receive(Signal)method when it's removeListener(Listener).
 boolean isRegistered(Listener listener)
          Check whether a listener is registered or not.
 void notify(Signal signal)
          Broadcast a signal.
 void removeAllListeners()
          Unconditionally unregister all the listeners.
 void removeListener(Listener listener)
          Remove a listener from the listeners set.
 void setReceiveTimeout(long receiveTimeout)
          Set the the amount of time(in ms.) a Listeneris given to exit gracefully from the Listener.receive(Signal)method when it's removeListener(Listener).
 

Method Detail

addListener

public void addListener(Listener listener)
Add a listener to the listeners set.

Parameters:
listener - the listener to add

removeListener

public void removeListener(Listener listener)
                    throws BlockedListenerException
Remove a listener from the listeners set.

Parameters:
listener - the listener to remove
Throws:
BlockedListenerException - if the listener is blocked and cannot be removed

removeAllListeners

public void removeAllListeners()
Unconditionally unregister all the listeners.


isRegistered

public boolean isRegistered(Listener listener)
Check whether a listener is registered or not.

Parameters:
listener - the listener to check
Returns:
true if the listener is registered

notify

public void notify(Signal signal)
Broadcast a signal. The order of invocation is unspecified.


countListeners

public int countListeners()
Count the registered listeners.

Returns:
the number of currently registered listeners
See Also:
countListeners()

getReceiveTimeout

public long getReceiveTimeout()
Return the the amount of time(in ms.) a Listeneris given to exit gracefully from the Listener.receive(Signal)method when it's removeListener(Listener).

Note that this timeout does not apply to normal operations (i.e. a listener can normally block for how long it wants) but only when a listener is removed.

Returns:
the timeout in milliseconds

setReceiveTimeout

public void setReceiveTimeout(long receiveTimeout)
Set the the amount of time(in ms.) a Listeneris given to exit gracefully from the Listener.receive(Signal)method when it's removeListener(Listener).

Note that this timeout does not apply to normal operations (i.e. a listener can normally block for how long it wants) but only when a listener is removed.

Parameters:
receiveTimeout - the timeout in milliseconds