Class ServiceManager.SimpleServiceManager
java.lang.Object
org.hyperledger.besu.plugin.ServiceManager.SimpleServiceManager
- All Implemented Interfaces:
ServiceManager
- Enclosing interface:
ServiceManager
A basic implementation of ServiceManager, suitable for tests.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ServiceManager
ServiceManager.SimpleServiceManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends BesuService>
voidaddService(Class<T> serviceType, T service) Add service.<T extends BesuService>
Optional<T> getService(Class<T> serviceType) Get the requested service, if it is available.
-
Constructor Details
-
SimpleServiceManager
public SimpleServiceManager()default constructor. commented here to appease the linter.
-
-
Method Details
-
addService
Description copied from interface:ServiceManagerAdd service. Used by core besu or other plugins to add services to the service manager.- Specified by:
addServicein interfaceServiceManager- Type Parameters:
T- the type parameter- Parameters:
serviceType- the service typeservice- the service
-
getService
Description copied from interface:ServiceManagerGet the requested service, if it is available. There are a number of reasons that a service may not be available:- The service may not have started yet. Most services are not available before the
BesuPlugin.start()method is called - The service is not supported by this version of Besu
- The service may not be applicable to the current configuration. For example some services may only be available when a proof of authority network is in use, or when user provided.
Since plugins are automatically loaded, unless the user has specifically requested functionality provided by the plugin, no error should be raised if required services are unavailable.
- Specified by:
getServicein interfaceServiceManager- Type Parameters:
T- the service type- Parameters:
serviceType- the class defining the requested service.- Returns:
- an optional containing the instance of the requested service, or empty if the service is unavailable
- The service may not have started yet. Most services are not available before the
-