Class Oort
- All Implemented Interfaces:
org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.LifeCycle
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classThis listener handles messages sent to/oort/cloudthat contains the list of comets connected to the Oort that just joined the cloud.static interfaceListener interface that gets notified of comet events, that is when a new comet joins the cloud or when a comet leaves the cloud.Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCometListener(Oort.CometListener listener) Registers the given listener to be notified of comet events.protected voidconfigureOortComet(OortComet oortComet) protected voidconnectComet(OortComet comet, Map<String, Object> fields) voiddeobserveChannel(String channelId) deobserveComet(String cometURL) protected voiddoStart()protected voiddoStop()voiddump(Appendable out, String indent) protected StringencodeSecret(String secret) protected OortCometorg.cometd.bayeux.server.BayeuxServerList<org.cometd.client.transport.ClientTransport.Factory>getId()org.cometd.common.JSONContext.Clientorg.cometd.bayeux.server.LocalSessionprotected ScheduledExecutorServicegetURL()booleanbooleanprotected booleanisCometConnected(String oortURL) booleanisOort(org.cometd.bayeux.server.ServerSession session) booleanisOortHandshake(org.cometd.bayeux.Message handshake) protected voidjoinComets(org.cometd.bayeux.Message message) protected OortCometnewOortComet(String cometURL) protected OortCometnewOortComet(String cometURL, org.cometd.client.transport.ClientTransport transport, org.cometd.client.transport.ClientTransport[] otherTransports) newOortHandshakeFields(String cometURL, String oortAliasURL) voidobserveChannel(String channelName) Observes the given channel, registering to receive messages from the Oort comets connected to this Oort instance.observeComet(String cometURL) Connects (if not already connected) and observes another Oort instance (identified by the given URL) via aOortCometinstance.protected voidprotectOortChannels(org.cometd.bayeux.server.BayeuxServer bayeux) voidremoveCometListener(Oort.CometListener listener) Deregisters the given listener from being notified of comet events.voidDeregisters all comet listeners.protected static StringreplacePunctuation(String source, char replacement) voidsetAckExtensionEnabled(boolean value) voidsetBinaryExtensionEnabled(boolean value) voidsetClientTransportFactories(List<org.cometd.client.transport.ClientTransport.Factory> factories) voidsetJSONContextClient(org.cometd.common.JSONContext.Client jsonContext) voidtoString()protected voidunprotectOortChannels(org.cometd.bayeux.server.BayeuxServer bayeux) Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListenersMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Field Details
-
OORT_ATTRIBUTE
-
EXT_OORT_FIELD
- See Also:
-
EXT_OORT_URL_FIELD
- See Also:
-
EXT_OORT_ID_FIELD
- See Also:
-
EXT_OORT_SECRET_FIELD
- See Also:
-
EXT_COMET_URL_FIELD
- See Also:
-
EXT_OORT_ALIAS_URL_FIELD
- See Also:
-
OORT_CLOUD_CHANNEL
- See Also:
-
OORT_SERVICE_CHANNEL
- See Also:
-
-
Constructor Details
-
Oort
-
-
Method Details
-
doStart
- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
protectOortChannels
protected void protectOortChannels(org.cometd.bayeux.server.BayeuxServer bayeux) -
unprotectOortChannels
protected void unprotectOortChannels(org.cometd.bayeux.server.BayeuxServer bayeux) -
getScheduler
-
getBayeuxServer
@ManagedAttribute(value="The BayeuxServer of this Oort", readonly=true) public org.cometd.bayeux.server.BayeuxServer getBayeuxServer() -
getURL
- Returns:
- the public absolute URL of the Oort CometD server
-
getId
-
getSecret
-
setSecret
-
isAckExtensionEnabled
@ManagedAttribute("Whether the acknowledgement extension is enabled") public boolean isAckExtensionEnabled() -
setAckExtensionEnabled
public void setAckExtensionEnabled(boolean value) -
isBinaryExtensionEnabled
@ManagedAttribute("Whether the binary extension is enabled") public boolean isBinaryExtensionEnabled() -
setBinaryExtensionEnabled
public void setBinaryExtensionEnabled(boolean value) -
getJSONContextClient
public org.cometd.common.JSONContext.Client getJSONContextClient() -
setJSONContextClient
public void setJSONContextClient(org.cometd.common.JSONContext.Client jsonContext) -
getClientTransportFactories
-
setClientTransportFactories
public void setClientTransportFactories(List<org.cometd.client.transport.ClientTransport.Factory> factories) -
observeComet
Connects (if not already connected) and observes another Oort instance (identified by the given URL) via a
OortCometinstance.- Parameters:
cometURL- the Oort URL to observe- Returns:
- The
OortCometinstance associated to the Oort instance identified by the URL or null if the given Oort URL represent this Oort instance
-
newOortComet
-
newOortComet
-
configureOortComet
-
encodeSecret
-
connectComet
-
deobserveComet
-
getKnownComets
@ManagedAttribute(value="URLs of known Oorts in the cluster", readonly=true) public Set<String> getKnownComets()- Returns:
- the set of known Oort comet servers URLs.
-
getComet
- Parameters:
cometURL- the URL of a Oort comet- Returns:
- the OortComet instance connected with the Oort comet with the given URL
-
findComet
- Parameters:
cometURL- the URL of a Oort comet- Returns:
- the OortComet instance connecting or connected with the Oort comet with the given URL
-
observeChannel
@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
OortCometinstances 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.- Parameters:
channelName- the channel to observe
-
deobserveChannel
@ManagedOperation(value="Deobserves the given channel", impact="ACTION") public void deobserveChannel(@Name(value="channel",description="The channel to deobserve") String channelId) -
isOort
public boolean isOort(org.cometd.bayeux.server.ServerSession session) - Parameters:
session- the server session to test- Returns:
- whether the given server session is one of those created by the Oort internal working
- See Also:
-
isOortHandshake
public boolean isOortHandshake(org.cometd.bayeux.Message handshake) - Parameters:
handshake- the handshake message to test- Returns:
- whether the given handshake message is coming from another Oort comet
that has been configured with the same
secret - See Also:
-
newOortHandshakeFields
-
isCometConnected
- Parameters:
oortURL- the comet URL to check for connection- Returns:
- whether the given comet is connected to this comet
-
addCometListener
Registers the given listener to be notified of comet events.- Parameters:
listener- the listener to add- See Also:
-
removeCometListener
Deregisters the given listener from being notified of comet events.- Parameters:
listener- the listener to remove- See Also:
-
removeCometListeners
public void removeCometListeners()Deregisters all comet listeners. -
joinComets
protected void joinComets(org.cometd.bayeux.Message message) -
getObservedChannels
-
getOortSession
public org.cometd.bayeux.server.LocalSession getOortSession()- Returns:
- the oortSession
-
replacePunctuation
-
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Overrides:
dumpin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
IOException
-
toString
- Overrides:
toStringin classorg.eclipse.jetty.util.component.AbstractLifeCycle
-