Package org.cometd.server
Class BayeuxServerImpl
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.cometd.server.BayeuxServerImpl
- All Implemented Interfaces:
org.cometd.bayeux.Bayeux,BayeuxServer,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
@ManagedObject("The CometD server")
public class BayeuxServerImpl
extends org.eclipse.jetty.util.component.ContainerLifeCycle
implements BayeuxServer, org.eclipse.jetty.util.component.Dumpable
-
Nested Class Summary
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.cometd.bayeux.Bayeux
org.cometd.bayeux.Bayeux.BayeuxListener, org.cometd.bayeux.Bayeux.ValidatorNested classes/interfaces inherited from interface org.cometd.bayeux.server.BayeuxServer
BayeuxServer.BayeuxServerListener, BayeuxServer.ChannelListener, BayeuxServer.Extension, BayeuxServer.SessionListener, BayeuxServer.SubscriptionListenerNested 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 StringFields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.cometd.bayeux.server.BayeuxServer
ATTRIBUTEFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(BayeuxServer.Extension extension) voidaddListener(BayeuxServer.BayeuxServerListener listener) protected voidaddServerSession(ServerSessionImpl session, ServerMessage message) addTransport(ServerTransport transport) org.cometd.bayeux.MarkedReference<ServerChannel>createChannelIfAbsent(String channelName, ConfigurableServerChannel.Initializer... initializers) protected ServerMessage.MutablecreateReply(ServerMessage.Mutable message) protected voiddoStart()protected voiddoStop()voiddump(Appendable out, String indent) protected voiderror(ServerMessage.Mutable reply, String error) voidprotected voidextendOutgoing(ServerSession sender, ServerSession session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) voidextendReply(ServerSessionImpl sender, ServerSessionImpl session, ServerMessage.Mutable reply, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) protected AbstractHttpTransportfindHttpTransport(jakarta.servlet.http.HttpServletRequest request) voidfreeze(ServerMessage.Mutable mutable) getChannel(String channelId) protected List<BayeuxServer.BayeuxServerListener>getName()protected booleanprotected longorg.eclipse.jetty.util.thread.SchedulergetSession(String clientId) getTransport(String transport) voidhandle(ServerSessionImpl session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) protected voidprotected voidprotected voidbooleanbooleanorg.cometd.bayeux.ChannelIdnewChannelId(String id) newLocalSession(String idHint) newMessage(ServerMessage original) protected voidpublish(ServerSessionImpl session, ServerChannelImpl channel, ServerMessage.Mutable message, boolean receiving, org.cometd.bayeux.Promise<Boolean> promise) longvoidremoveExtension(BayeuxServer.Extension extension) voidprotected booleanremoveServerChannel(ServerChannelImpl channel) booleanremoveServerSession(ServerSession session, boolean timeout) booleanremoveSession(ServerSession session) protected org.cometd.bayeux.Promise<Boolean>resolveLoop(AsyncFoldLeft.Loop<Boolean> loop) org.eclipse.jetty.util.thread.Scheduler.TaskEntry point to schedule tasks in CometD.voidsetAllowedTransports(String... allowed) voidsetAllowedTransports(List<String> allowed) voidsetDetailedDump(boolean detailedDump) voidsetExecutor(Executor executor) voidvoidsetOptions(Map<String, Object> options) voidsetScheduler(org.eclipse.jetty.util.thread.Scheduler scheduler) voidsetSecurityPolicy(SecurityPolicy securityPolicy) voidsetTransports(List<ServerTransport> transports) voidsetTransports(ServerTransport... transports) voidsweep()protected voidprotected StringvalidateMessage(ServerMessage.Mutable message) 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, stop, toStringMethods 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
dump, dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Field Details
-
ALLOWED_TRANSPORTS_OPTION
- See Also:
-
SWEEP_PERIOD_OPTION
- See Also:
-
TRANSPORTS_OPTION
- See Also:
-
VALIDATE_MESSAGE_FIELDS_OPTION
- See Also:
-
BROADCAST_TO_PUBLISHER_OPTION
- See Also:
-
SCHEDULER_THREADS
- See Also:
-
EXECUTOR_MAX_THREADS
- See Also:
-
-
Constructor Details
-
BayeuxServerImpl
public BayeuxServerImpl()
-
-
Method Details
-
getName
-
doStart
- Overrides:
doStartin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
initializeMetaChannels
protected void initializeMetaChannels() -
initializeJSONContext
- Throws:
Exception
-
initializeServerTransports
protected void initializeServerTransports() -
setExecutor
-
getExecutor
-
execute
-
setScheduler
public void setScheduler(org.eclipse.jetty.util.thread.Scheduler scheduler) -
getScheduler
public org.eclipse.jetty.util.thread.Scheduler getScheduler() -
schedule
Entry point to schedule tasks in CometD.
Subclasses may override and run the task in a
Executor, rather than in the scheduler thread.- Parameters:
task- the task to scheduledelay- the delay, in milliseconds, to run the task- Returns:
- the task promise
-
newChannelId
-
getOptions
-
getOption
@ManagedOperation(value="The value of the given configuration option", impact="INFO") public Object getOption(@Name("optionName") String qualifiedName) - Specified by:
getOptionin interfaceorg.cometd.bayeux.Bayeux
-
getOption
-
getOption
-
getOptionNames
- Specified by:
getOptionNamesin interfaceorg.cometd.bayeux.Bayeux
-
setOption
- Specified by:
setOptionin interfaceorg.cometd.bayeux.Bayeux
-
setOptions
-
randomLong
public long randomLong() -
getSecurityPolicy
- Specified by:
getSecurityPolicyin interfaceBayeuxServer
-
getJSONContext
-
createChannelIfAbsent
public org.cometd.bayeux.MarkedReference<ServerChannel> createChannelIfAbsent(String channelName, ConfigurableServerChannel.Initializer... initializers) - Specified by:
createChannelIfAbsentin interfaceBayeuxServer
-
getSessions
- Specified by:
getSessionsin interfaceBayeuxServer
-
getSession
- Specified by:
getSessionin interfaceBayeuxServer
-
addServerSession
-
removeSession
- Specified by:
removeSessionin interfaceBayeuxServer
-
removeServerSession
- Parameters:
session- the session to removetimeout- whether the session has been removed due to a timeout- Returns:
- true if the session was removed and was connected
-
newServerSession
-
newLocalSession
- Specified by:
newLocalSessionin interfaceBayeuxServer
-
newMessage
- Specified by:
newMessagein interfaceBayeuxServer
-
newMessage
-
setSecurityPolicy
- Specified by:
setSecurityPolicyin interfaceBayeuxServer
-
addExtension
- Specified by:
addExtensionin interfaceBayeuxServer
-
removeExtension
- Specified by:
removeExtensionin interfaceBayeuxServer
-
getExtensions
- Specified by:
getExtensionsin interfaceBayeuxServer
-
addListener
- Specified by:
addListenerin interfaceBayeuxServer
-
getChannel
- Specified by:
getChannelin interfaceBayeuxServer
-
getChannels
- Specified by:
getChannelsin interfaceBayeuxServer
-
removeListener
- Specified by:
removeListenerin interfaceBayeuxServer
-
handle
public void handle(ServerSessionImpl session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) -
validateMessage
-
publish
protected void publish(ServerSessionImpl session, ServerChannelImpl channel, ServerMessage.Mutable message, boolean receiving, org.cometd.bayeux.Promise<Boolean> promise) -
resolveLoop
-
freeze
-
extendOutgoing
protected void extendOutgoing(ServerSession sender, ServerSession session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
extendReply
public void extendReply(ServerSessionImpl sender, ServerSessionImpl session, ServerMessage.Mutable reply, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) -
removeServerChannel
-
getListeners
-
getKnownTransportNames
- Specified by:
getKnownTransportNamesin interfaceorg.cometd.bayeux.Bayeux
-
getTransport
- Specified by:
getTransportin interfaceorg.cometd.bayeux.Bayeux
-
addTransport
-
setTransports
-
setTransports
-
getTransports
-
findHttpTransport
-
getAllowedTransports
@ManagedAttribute(value="The transports allowed by this CometD server", readonly=true) public List<String> getAllowedTransports()- Specified by:
getAllowedTransportsin interfaceorg.cometd.bayeux.Bayeux
-
setAllowedTransports
-
setAllowedTransports
-
isBroadcastToPublisher
@ManagedAttribute(value="Whether this CometD server broadcast messages to the publisher", readonly=true) public boolean isBroadcastToPublisher() -
unknownSession
-
error
-
createReply
-
sweep
@ManagedOperation(value="Sweeps channels and sessions of this CometD server", impact="ACTION") public void sweep() -
isDetailedDump
@ManagedAttribute("Reports additional details in the dump() operation") public boolean isDetailedDump() -
setDetailedDump
public void setDetailedDump(boolean detailedDump) -
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Overrides:
dumpin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
IOException
-