Interface Service
-
- All Known Subinterfaces:
ClusterService
,ClusterServiceManager
,CodecService
,CoordinationService
,ElectionService
,InjectionService
,JmxService
,LockService
,MessagingService
,NetworkService
,NetworkServiceManager
,ResourceService
,RpcService
public interface Service
« start hereEntry point to core API ofHekate
services.Overview
Hekate
utilizes the Service-oriented approach in order to provide a fine grained control over resources utilization and functionality of each individualHekate
instance. Each instance can be configured with only those services that are required for application needs without an overhead of managing services that are never used by the application.Note: Typically applications are not required to implement their own custom services and can act purely as clients of services that are provided by
Hekate
out of the box. Custom services should be implemented only in order to extend functionality of existing services or provide some new functionality that is not covered byHekate
API.Service Interface
All services must implement
Service
marker interface in order to be accessible viaHekate.get(Class)
method and can also optionally implement a set of callback interfaces in order to participate inHekate
instance lifecycle.The following lifecycle interfaces are available (in invocation order):
DependentService
- for resolving dependencies on other services.ConfigurableService
- for preparing and validating service configurationInitializingService
- for service state initialization before theHekate
node starts joining the clusterTerminatingService
- for service state cleanup when theHekate
node leaves the cluster
Please see the documentation of those interfaces for more details.
Service Factory
Each service must have a
ServiceFactory
that is responsible for configuring and creating new service instances. Service factories can be registered viaHekateBootstrap.setServices(List)
method.Note: Each service gets
created
only once by eachHekate
node during the initialization phase and never gets re-created even if node leaves and then rejoins the cluster.- See Also:
Hekate.get(Class)