public interface Service<T> extends Component<ServiceDescriptor,ServerEnvironment>
stop
call.
Therefore it is necessary to ensure all instances passed by to this service (e.g. during init
)
must be cleaned up during stop
and needs to be requested again during next
init
and start
Modifier and Type | Method and Description |
---|---|
Class<? extends ServiceProxy<T>> |
getProxyClass()
A service proxy is an optional, client-side service implementation.
|
Class<? extends T> |
getServiceInterface()
Returns the service server / communication interface.
|
boolean |
isRunning()
Returns whether the service is running.
|
void |
start()
Starts the service.
|
void |
stop()
Stops the service.
|
init, installed, uninstalling, updated
void start()
environment
(e.g. specialistbroker
) which is passed by in
Component.init(ComponentDescriptor, ServerEnvironment)
, it is recommended to request this instances
in this start method or later on demand. These instances will become invalid after stop()
and needs to
requested again during next start()
void stop()
start()
.broker
provided by the environment
during Component.init(ComponentDescriptor, ServerEnvironment)
will become invalid after stop.boolean isRunning()
true
if the service is running.@Nullable Class<? extends T> getServiceInterface()
Service
instances must also implement this interface.proxy class
is specified this interface must be used to
request
the service instance.getProxyClass()
@Nullable Class<? extends ServiceProxy<T>> getProxyClass()
initialized
and returned by
Connection.getService(String)
. The proxy class must have
a no-arg constructor and must implement the ServiceProxy
interface, but has not to implement the
communication interface
itself.
It is recommended that the proxy class implements an interface because the proxy instance will be requested
with this interface.
For the following usecases it is useful to specify a proxy class:
1) Caching
: communication interface
.
In this case the proxy class normally implements the communication interface
itself and that is
used to request the service.
2) Serialization or slim interface for external use
:external usage
but need more functions in the internal communication interface
or you want to provide an interface with signatures containing non serializable objects it is necessary
to define an interface which is implemented by this proxy class which is different to the
communication interface
.
In this case the proxy class should not implement the communication interface
.null
if no proxy is provided.Copyright © 2015 e-Spirit AG. All Rights Reserved. Build 5.1.408