public interface Service extends Service
Modifier and Type | Interface and Description |
---|---|
static interface |
Service.MemberJoinAction
MemberJoinAction is taken to allow a new member to join a clustered
Service.
|
Modifier and Type | Method and Description |
---|---|
void |
addMemberListener(MemberListener listener)
Add a Member listener.
|
Cluster |
getCluster()
Return the Cluster object that this Service is a part of.
|
ServiceDependencies |
getDependencies()
Return the service's dependencies.
|
ServiceInfo |
getInfo()
Return the ServiceInfo object for this Service.
|
int |
getMinimumServiceVersion()
Return the minimum version for the members in this set.
|
ResourceRegistry |
getResourceRegistry()
Retrieves a Service scoped
ResourceRegistry . |
Serializer |
getSerializer()
Return a Serializer used by this Service.
|
Object |
getUserContext()
Return the user context object associated with this Service.
|
boolean |
isVersionCompatible(int nVersion)
Check whether the members of this service run a version that is greater than
or equal to the specified version.
|
boolean |
isVersionCompatible(int nYear,
int nMonth,
int nPatch)
Check whether the members of this service run a version that is greater than
or equal to the specified version.
|
boolean |
isVersionCompatible(int nMajor,
int nMinor,
int nMicro,
int nPatchSet,
int nPatch)
Check whether the members of this service run a version that is greater than
or equal to the specified version.
|
boolean |
isVersionCompatible(IntPredicate predicate)
Check whether the members of this service run a minimum service version
that matches a specified
IntPredicate . |
void |
removeMemberListener(MemberListener listener)
Remove a Member listener.
|
void |
setDependencies(ServiceDependencies deps)
Configure the Service.
|
void |
setUserContext(Object oCtx)
Associate a user context object with this Service.
|
addServiceListener, removeServiceListener
configure, isRunning, shutdown, start, stop
getContextClassLoader, setContextClassLoader
Cluster getCluster()
ServiceInfo getInfo()
void addMemberListener(MemberListener listener)
MemberListeners will be invoked in the order in which they are registered.
listener
- the MemberListener
to addvoid removeMemberListener(MemberListener listener)
listener
- the MemberListener
to removeObject getUserContext()
The data type and semantics of this context object are entirely application specific and are opaque to the Service itself.
void setUserContext(Object oCtx)
oCtx
- a user context objectSerializer getSerializer()
void setDependencies(ServiceDependencies deps)
This method can only be called before the Service is started.
deps
- the dependencies object carrying configuration information
specific to this ServiceIllegalStateException
- thrown if the Service is already runningIllegalArgumentException
- thrown if the configuration information
is invalidServiceDependencies getDependencies()
ResourceRegistry getResourceRegistry()
ResourceRegistry
. The resource
registry is used to:
ResourceRegistry
API for details on how to enable
cleanup of resources.
boolean isVersionCompatible(int nMajor, int nMinor, int nMicro, int nPatchSet, int nPatch)
nMajor
- the major version numbernMinor
- the minor version numbernMicro
- the micro version numbernPatchSet
- the patch set version numbernPatch
- the patch version numbertrue
if the members of the service are all running a version that
is greater than or equal to the specified versionboolean isVersionCompatible(int nYear, int nMonth, int nPatch)
nYear
- the year version numbernMonth
- the month version numbernPatch
- the patch version numbertrue
if the members of the service are all running a version that
is greater than or equal to the specified versionboolean isVersionCompatible(int nVersion)
nVersion
- the encoded version to comparetrue
if the members of the service are all running a version that
is greater than or equal to the specified versionboolean isVersionCompatible(IntPredicate predicate)
IntPredicate
.predicate
- an IntPredicate
to apply to the minimum encoded service versiontrue
if the minimum service version matches the predicateint getMinimumServiceVersion()
The version is the int
encoded version
(see VersionHelper
).