public abstract class ManagedObject<C extends Configuration> extends Object implements java.io.Closeable, ThreadSafe
A new instance of the plugin's
ManagedObject class will be created every time the plugin's configuration
is modified; including server startup. The new
Configuration object is passed to the new instance of
ManagedObject via its
close() method and the constructor of the new instance may be called from different Threads.
The plugin will not be available until the constructor of this object finishes running. If it never completes or throws an Exception, then the plugin will not become active and all requests to the server that require this plugin will respond with an error.
A plugin type may receive an instance of the
ManagedObject by injection into its constructor in the same
manner as it receives an instance of its
All implementations extending this abstract class must be Thread-safe.
|Constructor and Description|
Create and initialize this
public ManagedObject(C configuration)
A new instance of this type will be created by the server every time the plugin configuration is modified.
The provided Configuration instance will contain only primitive values and nested configuration
objects. Calling a method that returns a service will result in an
UnsupportedOperationException at runtime.
If this constructor throws an Exception, then the plugin will not become active until the next configuration change (when this instance will be closed, and the new instance initialized).
configuration- of the plugin.
public void close() throws java.io.IOException
This method is called every time the plugin configuration is modified (just before the new instance is created) and on server shutdown.
Exception is thrown, the error will be logged but the next instance of this object will be
initialized anyway, unless it is a server shutdown.
The default implementation of this method does not do anything.