- 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.
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 class
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
Listener 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.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPING
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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) deobserveComet
(String cometURL) protected void
doStart()
protected void
doStop()
void
dump
(Appendable out, String indent) protected String
encodeSecret
(String secret) protected OortComet
getId()
protected ScheduledExecutorService
getURL()
boolean
boolean
protected boolean
isCometConnected
(String oortURL) boolean
isOort
(ServerSession session) boolean
isOortHandshake
(Message handshake) protected void
joinComets
(Message message) newOortComet
(String cometURL) protected OortComet
newOortComet
(String cometURL, ClientTransport transport, ClientTransport[] otherTransports) 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.observeComet
(String cometURL) Connects (if not already connected) and observes another Oort instance (identified by the given URL) via aOortComet
instance.protected void
protectOortChannels
(BayeuxServer bayeux) void
removeCometListener
(Oort.CometListener listener) Deregisters the given listener from being notified of comet events.void
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
toString()
protected void
unprotectOortChannels
(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, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListeners
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelf
Methods 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
-
doStop
-
protectOortChannels
-
unprotectOortChannels
-
getScheduler
-
getBayeuxServer
@ManagedAttribute(value="The BayeuxServer of this Oort", readonly=true) public 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
-
setJSONContextClient
-
getClientTransportFactories
-
setClientTransportFactories
-
observeComet
Connects (if not already connected) and observes another Oort instance (identified by the given URL) via a
OortComet
instance.- Parameters:
cometURL
- the Oort URL to observe- Returns:
- The
OortComet
instance associated to the Oort instance identified by the URL or null if the given Oort URL represent this Oort instance
-
newOortComet
-
newOortComet
protected OortComet newOortComet(String cometURL, ClientTransport transport, ClientTransport[] otherTransports) -
configureOortComet
-
encodeSecret
-
connectComet
-
deobserveComet
-
getKnownComets
-
getComet
-
findComet
-
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
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.- 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
- 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
-
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.- See Also:
-
joinComets
-
getObservedChannels
-
getOortSession
- Returns:
- the oortSession
-
replacePunctuation
-
dump
- Specified by:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
- Overrides:
dump
in classorg.eclipse.jetty.util.component.ContainerLifeCycle
- Throws:
IOException
-
toString
- Overrides:
toString
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
-