Package org.jppf.utils.hooks
Class Hook<E>
java.lang.Object
org.jppf.utils.hooks.Hook<E>
- Type Parameters:
E-
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionHook(Class<E> infClass, E defaultImpl, ClassLoader loader, boolean single) Register a hook defined via SPI.Hook(Class<E> infClass, E defaultImpl, ClassLoader loader, boolean single, Class<?>[] paramTypes, Object... params) Register a hook defined via SPI.Hook(JPPFProperty<String> property, Class<E> infClass, E defaultImpl, ClassLoader loader) Register a hook defined via a configuration property, of which a single instance is discovered and invoked.Hook(JPPFProperty<String> property, Class<E> infClass, E defaultImpl, ClassLoader loader, Class<?>[] paramTypes, Object... params) Register a hook defined via a configuration property, of which a single instance is discovered and invoked. -
Method Summary
-
Constructor Details
-
Hook
Register a hook defined via a configuration property, of which a single instance is discovered and invoked.- Parameters:
property- the name of the property used to specify the hook implementation class name.infClass- the class of the hook's interface.defaultImpl- the default implementation, which may be null.loader- the class loader used to load the implemntation.
-
Hook
public Hook(JPPFProperty<String> property, Class<E> infClass, E defaultImpl, ClassLoader loader, Class<?>[] paramTypes, Object... params) Register a hook defined via a configuration property, of which a single instance is discovered and invoked.- Parameters:
property- the name of the property used to specify the hook implementation class name.infClass- the class of the hook's interface.defaultImpl- the default implementation, which may be null.loader- the class loader used to load the implemntation.paramTypes- types of the parameters to pass to the constructor.params- the parameters to pass to the constructor.
-
Hook
Register a hook defined via SPI.- Parameters:
infClass- the class of the hook's interface.defaultImpl- the default implementation, which may benull.loader- the class loader used to load the implemntation.single- determines whether only the first looked up implementation should be used, or all the instances found.
-
Hook
public Hook(Class<E> infClass, E defaultImpl, ClassLoader loader, boolean single, Class<?>[] paramTypes, Object... params) Register a hook defined via SPI.- Parameters:
infClass- the class of the hook's interface.defaultImpl- the default implementation, which may benull.loader- the class loader used to load the implemntation.single- determines whether only the first looked up implementation should be used, or all the instances found.paramTypes- types of the parameters to pass to the constructor.params- the parameters to pass to the constructor.
-
-
Method Details
-
getInterfaceName
Get the hook interface.- Returns:
- the class object for the hook's interface.
-
getType
Get the type of this hook.- Returns:
- the type as a typesafe
HookTypeenum value.
-
invoke
Invoke each instance of this hook.- Parameters:
methodName- the name of the implementation method to invoke.parameters- the parameters supplied to each method invocation.- Returns:
- this method always return null.
-
toString
-
getInstances
Get the list of instances of this hook.- Returns:
- a list of
HookInstanceobjects.
-
dispose
public void dispose()Cleanup this hook and release its resources.
-