2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Apache > HiveMind
Font size:      

HiveMind Servlet Filter

HiveMind includes a feature to streamline the use of HiveMind within a web application: a servlet filter that can automatically construct the HiveMind Registry and ensure that end-of-request thread cleanup occurs.

The filter class is HiveMindFilter. It constructs a standard HiveMind Registry (and includes WEB-INF/hivemodule.xml, if present) when initialized, and will shutdown the Registry when the containing application is undeployed.

Each request will be terminated with a call to the Registry's cleanupThread() method, which will cleanup any thread-local values, including service implementations that are bound to the current thread.

The HiveMindFilter class includes a static method for accessing the Registry.

Deployment Descriptor

To make use of the filter, it must be declared inside the web deployment descriptor (web.xml). Filters can be attached to servlets, or URL patterns, or both. Here's an example: