R - the result typeC - the opaque context typeOortMasterLongpublic abstract class OortMasterService<R,C> extends OortService<R,C>
OortMasterService extends OortService to allow applications
to perform actions on entities that always live in a "master" node.
Applications may have entities that are naturally owned by any node. For example, in a chat application a chat room may be created by a user in any node, and be owned by the node the user that created it is connected to.
There are cases, however, where entities cannot be owned by any node, but instead must be owned by one node only, usually referred to as the "master" node.
A typical example of such an entity is a unique (across the cluster) ID
generator that produces IDs in the form of long - the primitive Java
type - values, or a service that accesses a storage (such as a file system)
that is only available on a particular node, etc.
OortMasterService makes easier to write services that perform actions
on entities that must be owned by a single node only.
There is one instance of OortMasterService with the same name for each
node, but only one of them is the "master".
Then, applications may call getMasterOortURL() to get the Oort URL
of the "master" node, and pass that Oort URL to
OortService.forward(String, Object, Object) as described in OortService.
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerorg.cometd.bayeux.server.ConfigurableServerChannel.ServerChannelListener.Weakorg.eclipse.jetty.util.component.LifeCycle.ListenerOortService.Request, OortService.Result<U>, OortService.ServerContextFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPINGlogger| Constructor | Description |
|---|---|
OortMasterService(Oort oort,
java.lang.String name,
boolean master) |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
doStart() |
|
protected void |
doStop() |
|
java.lang.String |
getMasterOortURL() |
|
boolean |
isMaster() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforward, getLocalSession, getName, getOort, getTimeout, onForward, onForwardFailed, onForwardMessage, onForwardSucceeded, onMessage, onResultMessage, setTimeout, toStringpublic OortMasterService(Oort oort, java.lang.String name, boolean master)
oort - the oort this instance is associated toname - the name of this servicemaster - whether this service lives on the "master" nodepublic boolean isMaster()
public java.lang.String getMasterOortURL()
protected void doStart()
throws java.lang.Exception
doStart in class OortService<R,C>java.lang.Exceptionprotected void doStop()
throws java.lang.Exception
doStop in class OortService<R,C>java.lang.ExceptionCopyright © 2008–2017 The CometD Project. All rights reserved.