R- the result type
C- the opaque context type
public abstract class OortPrimaryService<R,C> extends OortService<R,C>
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 "primary" 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.
OortPrimaryService makes easier to write services that perform actions
on entities that must be owned by a single node only.
There is one instance of
OortPrimaryService with the same name for each
node, but only one of them is the "primary".
Then, applications may call
getPrimaryOortURL() to get the Oort URL
of the "primary" node, and pass that Oort URL to
OortService.forward(String, Object, Object) as described in
OortService.Request, OortService.Result<U>, OortService.ServerContext
|Constructor and Description|
|Modifier and Type||Method and Description|
forward, getLocalSession, getName, getOort, getTimeout, onForward, onForwardFailed, onForwardMessage, onForwardSucceeded, onMessage, onResultMessage, setTimeout, toString
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public boolean isPrimary()
public String getPrimaryOortURL()
protected void doStart() throws Exception
Copyright © 2008–2023 The CometD Project. All rights reserved.