public interface Service
When writing MSC service implementations, your start(StartContext)
and stop(StopContext)
methods must never block. This means these methods must not:
LifecycleContext.asynchronous()
) and do one of the following:
LifecycleContext.complete()
when your start/stop completes instead of blockingExecutor
) which calls
LifecycleContext.complete()
when done
Note that using LifecycleContext.execute(Runnable)
to execute the blocking task is also not permissible.
Modifier and Type | Field and Description |
---|---|
static Service |
NULL
A simple null service whose start and stop methods do nothing.
|
Modifier and Type | Method and Description |
---|---|
static <V> Service |
newInstance(Consumer<V> injector,
V value)
Factory for services providing single value.
|
void |
start(StartContext context)
Start the service.
|
void |
stop(StopContext context)
Stop the service.
|
static final Service NULL
void start(StartContext context) throws StartException
If the service start involves any activities that may block, the asynchronous mechanism
provided by the context
should be used. See the class javadoc
for details.
context
- the context which can be used to trigger an asynchronous service startStartException
- if the service could not be started for some reasonvoid stop(StopContext context)
If the service start involves any activities that may block, the asynchronous mechanism
provided by the context
should be used. See the class javadoc
for details.
context
- the context which can be used to trigger an asynchronous service stopCopyright © 2019 JBoss by Red Hat. All rights reserved.