T
- the type of value that this service provides; may be Void
Service
instead.
This class will be removed in a future release.@Deprecated public interface Service<T> extends Service, Value<T>
start()
, and uninjections will
always happen from the same thread that had called stop()
. However no other guarantees are made with respect
to locking or thread safety; a robust service implementation should always take care to protect any mutable state
appropriately.
The value type specified by this service is used by default by consumers of this service, and should represent the public interface of this service, which may or may not be the same as the implementing type of this 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<Void> |
NULL
Deprecated.
A simple null service which performs no start or stop action.
|
static Value<Service<Void>> |
NULL_VALUE
Deprecated.
A value which resolves to the
null service . |
Modifier and Type | Method and Description |
---|---|
void |
start(StartContext context)
Deprecated.
Start the service.
|
void |
stop(StopContext context)
Deprecated.
Stop the service.
|
newInstance
static final Service<Void> NULL
static final Value<Service<Void>> NULL_VALUE
null service
.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.
start
in interface Service
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.
Copyright © 2021 JBoss by Red Hat. All rights reserved.