org.apache.hivemind.service
Interface ThreadEventNotifier

All Known Implementing Classes:
ThreadEventNotifierImpl

public interface ThreadEventNotifier

Service which acts as a dispatch hub for events about the lifecycle of the current thread.

Note: prior to release 1.1.1, the ThreadEventNotifier implementation would retain the listeners after fireThreadCleanup(), which could allow certain threads to retain a reference to a listener, and thus that listener's class loader, even after the an application redeployment, resulting in a massive memory leak. Starting with release 1.1.1, all listeners are discarded by fireThreadCleanup().

Author:
Howard Lewis Ship

Method Summary
 void addThreadCleanupListener(ThreadCleanupListener listener)
          Adds the listener.
 void fireThreadCleanup()
          Invokes ThreadCleanupListener.threadDidCleanup() on all listeners, and discards the list of listeners.
 void removeThreadCleanupListener(ThreadCleanupListener listener)
          Removes the listener, if it has been previously added.
 

Method Detail

addThreadCleanupListener

void addThreadCleanupListener(ThreadCleanupListener listener)
Adds the listener. The notifier retains the listener until fireThreadCleanup() is invoked, at which point is discarded.


removeThreadCleanupListener

void removeThreadCleanupListener(ThreadCleanupListener listener)
Removes the listener, if it has been previously added. If the listener has been added multiple times, only one instance is removed. Note that this method is rarely used, because all listeners are automatically removed by fireThreadCleanup().


fireThreadCleanup

void fireThreadCleanup()
Invokes ThreadCleanupListener.threadDidCleanup() on all listeners, and discards the list of listeners.



Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.