PluginDispatcher (Hadoop 0.20.2+320 API)
Date: 2010-06-28

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.util
Class PluginDispatcher<T extends ServicePlugin>

    java.lang.Object
      org.apache.hadoop.util.PluginDispatcher<T>

    public class PluginDispatcher<T extends ServicePlugin>

extends Object

Provides convenience functions for dispatching calls through to plugins registered with a class. Classes that wish to provide plugin interfaces should use this class to load the plugin list from the Configuration and to dispatch calls to the loaded instances. Calls dispatched through this class are performed on a second thread so as to not block execution of the plugged service.

Field Summary
`static org.apache.commons.logging.Log` | `LOG`

Method Summary
`static
`<X extends ServicePlugin> PluginDispatcher<X>`
` | `createFromConfiguration(Configuration conf, String key, Class<X> clazz)` Load a PluginDispatcher from the given Configuration.
`void` | `dispatchCall(SingleArgumentRunnable<T> callback)` Dispatch a call to all active plugins.
`void` | `dispatchStart(Object plugPoint)` Dispatches the start(...) hook common to all ServicePlugins.
`void` | `dispatchStop()` Convenience function for dispatching the stop() hook common to all ServicePlugins.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOG

    public static final org.apache.commons.logging.Log LOG

Method Detail

### createFromConfiguration

    public static <X extends ServicePlugin> PluginDispatcher<X> createFromConfiguration(Configuration conf,
                                                                                        String key,
                                                                                        Class<X> clazz)

  Load a PluginDispatcher from the given Configuration. The start() callback will not be automatically called.

  Parameters:
    `conf` - the Configuration from which to load
    `key` - the configuration key that lists class names to instantiate
    `clazz` - the class or interface from which plugins must extend

### dispatchCall

    public void dispatchCall(SingleArgumentRunnable<T> callback)

  Dispatch a call to all active plugins. Exceptions will be caught and logged at WARN level.

  Parameters:
    `callback` - a function which will run once for each plugin, with that plugin as the argument

### dispatchStart

    public void dispatchStart(Object plugPoint)

  Dispatches the start(...) hook common to all ServicePlugins. This also automatically removes any plugin that throws an exception while attempting to start.

  Parameters:
    `plugPoint` - passed to ServicePlugin.start()

### dispatchStop

    public void dispatchStop()

  Convenience function for dispatching the stop() hook common to all ServicePlugins.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation