@ManagedObject(value="CometD cloud node")
public class Oort
extends org.eclipse.jetty.util.component.ContainerLifeCycle
Oort is the cluster manager that links one CometD server to a set of other CometD servers.
The Oort instance is created and configured by either OortMulticastConfigServlet
or
OortStaticConfigServlet
.
This class maintains a collection of OortComet
instances to each
CometD server, created by calls to observeComet(String)
.
The key configuration parameter is the Oort URL, which is
full public URL of the CometD servlet to which the Oort instance is bound,
for example: http://myserver:8080/context/cometd
.
Oort instances can be configured with a shared secret
, which allows
the Oort instance to distinguish handshakes coming from remote clients from handshakes coming from
other Oort comets: the firsts may be subject to a stricter authentication policy than the seconds.
Modifier and Type | Class and Description |
---|---|
protected class |
Oort.CloudListener
This listener handles messages sent to
/oort/cloud that contains the list of comets
connected to the Oort that just joined the cloud. |
static interface |
Oort.CometListener
Listener interface that gets notified of comet events, that is when a new
comet joins the cloud or when a comet leaves the cloud.
|
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
Modifier and Type | Field and Description |
---|---|
static String |
EXT_COMET_URL_FIELD |
static String |
EXT_OORT_ALIAS_URL_FIELD |
static String |
EXT_OORT_FIELD |
static String |
EXT_OORT_ID_FIELD |
static String |
EXT_OORT_SECRET_FIELD |
static String |
EXT_OORT_URL_FIELD |
static String |
OORT_ATTRIBUTE |
static String |
OORT_CLOUD_CHANNEL |
static String |
OORT_SERVICE_CHANNEL |
Constructor and Description |
---|
Oort(BayeuxServer bayeux,
String url) |
Modifier and Type | Method and Description |
---|---|
void |
addCometListener(Oort.CometListener listener)
Registers the given listener to be notified of comet events.
|
protected void |
configureOortComet(OortComet oortComet) |
protected void |
connectComet(OortComet comet,
Map<String,Object> fields) |
void |
deobserveChannel(String channelId) |
OortComet |
deobserveComet(String cometURL) |
protected void |
doStart() |
protected void |
doStop() |
void |
dump(Appendable out,
String indent) |
protected String |
encodeSecret(String secret) |
protected OortComet |
findComet(String cometURL) |
BayeuxServer |
getBayeuxServer() |
List<ClientTransport.Factory> |
getClientTransportFactories() |
OortComet |
getComet(String cometURL) |
String |
getId() |
JSONContext.Client |
getJSONContextClient() |
Set<String> |
getKnownComets() |
Set<String> |
getObservedChannels() |
LocalSession |
getOortSession() |
protected ScheduledExecutorService |
getScheduler() |
String |
getSecret() |
String |
getURL() |
boolean |
isAckExtensionEnabled() |
boolean |
isBinaryExtensionEnabled() |
protected boolean |
isCometConnected(String oortURL) |
boolean |
isOort(ServerSession session) |
boolean |
isOortHandshake(Message handshake) |
protected void |
joinComets(Message message) |
protected OortComet |
newOortComet(String cometURL) |
protected OortComet |
newOortComet(String cometURL,
ClientTransport transport,
ClientTransport[] otherTransports) |
protected Map<String,Object> |
newOortHandshakeFields(String cometURL,
String oortAliasURL) |
void |
observeChannel(String channelName)
Observes the given channel, registering to receive messages from
the Oort comets connected to this Oort instance.
|
OortComet |
observeComet(String cometURL)
Connects (if not already connected) and observes another Oort instance
(identified by the given URL) via a
OortComet instance. |
protected void |
protectOortChannels(BayeuxServer bayeux) |
void |
removeCometListener(Oort.CometListener listener)
Deregisters the given listener from being notified of comet events.
|
void |
removeCometListeners()
Deregisters all comet listeners.
|
protected static String |
replacePunctuation(String source,
char replacement) |
void |
setAckExtensionEnabled(boolean value) |
void |
setBinaryExtensionEnabled(boolean value) |
void |
setClientTransportFactories(List<ClientTransport.Factory> factories) |
void |
setJSONContextClient(JSONContext.Client jsonContext) |
void |
setSecret(String secret) |
String |
toString() |
protected void |
unprotectOortChannels(BayeuxServer bayeux) |
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isDumpable
public static final String OORT_ATTRIBUTE
public static final String EXT_OORT_FIELD
public static final String EXT_OORT_URL_FIELD
public static final String EXT_OORT_ID_FIELD
public static final String EXT_OORT_SECRET_FIELD
public static final String EXT_COMET_URL_FIELD
public static final String EXT_OORT_ALIAS_URL_FIELD
public static final String OORT_CLOUD_CHANNEL
public static final String OORT_SERVICE_CHANNEL
public Oort(BayeuxServer bayeux, String url)
protected void doStart() throws Exception
doStart
in class org.eclipse.jetty.util.component.ContainerLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class org.eclipse.jetty.util.component.ContainerLifeCycle
Exception
protected void protectOortChannels(BayeuxServer bayeux)
protected void unprotectOortChannels(BayeuxServer bayeux)
protected ScheduledExecutorService getScheduler()
@ManagedAttribute(value="The BayeuxServer of this Oort", readonly=true) public BayeuxServer getBayeuxServer()
@ManagedAttribute(value="The URL of this Oort", readonly=true) public String getURL()
@ManagedAttribute(value="The unique ID of this Oort", readonly=true) public String getId()
@ManagedAttribute(value="The secret of this Oort") public String getSecret()
public void setSecret(String secret)
@ManagedAttribute(value="Whether the acknowledgement extension is enabled") public boolean isAckExtensionEnabled()
public void setAckExtensionEnabled(boolean value)
@ManagedAttribute(value="Whether the binary extension is enabled") public boolean isBinaryExtensionEnabled()
public void setBinaryExtensionEnabled(boolean value)
public JSONContext.Client getJSONContextClient()
public void setJSONContextClient(JSONContext.Client jsonContext)
public List<ClientTransport.Factory> getClientTransportFactories()
public void setClientTransportFactories(List<ClientTransport.Factory> factories)
public OortComet observeComet(String cometURL)
Connects (if not already connected) and observes another Oort instance
(identified by the given URL) via a OortComet
instance.
cometURL
- the Oort URL to observeOortComet
instance associated to the Oort instance identified by the URL
or null if the given Oort URL represent this Oort instanceprotected OortComet newOortComet(String cometURL, ClientTransport transport, ClientTransport[] otherTransports)
protected void configureOortComet(OortComet oortComet)
@ManagedAttribute(value="URLs of known Oorts in the cluster", readonly=true) public Set<String> getKnownComets()
public OortComet getComet(String cometURL)
cometURL
- the URL of a Oort cometprotected OortComet findComet(String cometURL)
cometURL
- the URL of a Oort comet@ManagedOperation(value="Observes the given channel", impact="ACTION") public void observeChannel(@Name(value="channel",description="The channel to observe") String channelName)
Observes the given channel, registering to receive messages from the Oort comets connected to this Oort instance.
Once observed, all OortComet
instances subscribe
to the channel and will repeat any messages published to
the local channel (with loop prevention), so that the
messages are distributed to all Oort comet servers.
channelName
- the channel to observe@ManagedOperation(value="Deobserves the given channel", impact="ACTION") public void deobserveChannel(@Name(value="channel",description="The channel to deobserve") String channelId)
public boolean isOort(ServerSession session)
session
- the server session to testisOortHandshake(Message)
public boolean isOortHandshake(Message handshake)
handshake
- the handshake message to testsecret
isOort(ServerSession)
protected Map<String,Object> newOortHandshakeFields(String cometURL, String oortAliasURL)
protected boolean isCometConnected(String oortURL)
oortURL
- the comet URL to check for connectionpublic void addCometListener(Oort.CometListener listener)
listener
- the listener to addremoveCometListener(CometListener)
public void removeCometListener(Oort.CometListener listener)
listener
- the listener to removeaddCometListener(CometListener)
public void removeCometListeners()
protected void joinComets(Message message)
public LocalSession getOortSession()
public void dump(Appendable out, String indent) throws IOException
dump
in interface org.eclipse.jetty.util.component.Dumpable
dump
in class org.eclipse.jetty.util.component.ContainerLifeCycle
IOException
public String toString()
toString
in class org.eclipse.jetty.util.component.AbstractLifeCycle
Copyright © 2008–2024 The CometD Project. All rights reserved.