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, org.cometd.bayeux.server.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 org.cometd.bayeux.server.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
org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener, org.cometd.bayeux.server.BayeuxServer.ChannelListener, org.cometd.bayeux.server.BayeuxServer.Extension, org.cometd.bayeux.server.BayeuxServer.SessionListener, org.cometd.bayeux.server.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 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(org.cometd.bayeux.server.BayeuxServer.Extension extension) voidaddListener(org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener listener) voidaddServerSession(ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage message) org.cometd.bayeux.server.ServerTransportaddTransport(org.cometd.bayeux.server.ServerTransport transport) org.cometd.bayeux.MarkedReference<org.cometd.bayeux.server.ServerChannel> createChannelIfAbsent(String channelName, org.cometd.bayeux.server.ConfigurableServerChannel.Initializer... initializers) protected org.cometd.bayeux.server.ServerMessage.MutablecreateReply(org.cometd.bayeux.server.ServerMessage.Mutable message) protected voiddoStart()protected voiddoStop()voiddump(Appendable out, String indent) protected voidvoidprotected voidextendOutgoing(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerSession session, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) voidextendReply(ServerSessionImpl sender, ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage.Mutable reply, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) voidfreeze(org.cometd.bayeux.server.ServerMessage.Mutable mutable) org.cometd.bayeux.server.ServerChannelgetChannel(String channelId) List<org.cometd.bayeux.server.ServerChannel> List<org.cometd.bayeux.server.BayeuxServer.Extension> protected List<org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener> getName()protected booleanprotected longorg.eclipse.jetty.util.thread.Schedulerorg.cometd.bayeux.server.SecurityPolicyorg.cometd.bayeux.server.ServerSessiongetSession(String clientId) List<org.cometd.bayeux.server.ServerSession> longintorg.cometd.bayeux.server.ServerTransportgetTransport(String transport) List<org.cometd.bayeux.server.ServerTransport> voidhandle(ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) protected voidprotected voidprotected voidbooleanbooleanorg.cometd.bayeux.ChannelIdnewChannelId(String id) org.cometd.bayeux.server.LocalSessionnewLocalSession(String idHint) org.cometd.bayeux.server.ServerMessage.Mutableorg.cometd.bayeux.server.ServerMessage.MutablenewMessage(org.cometd.bayeux.server.ServerMessage original) protected voidpublish(ServerSessionImpl session, ServerChannelImpl channel, org.cometd.bayeux.server.ServerMessage.Mutable message, boolean receiving, org.cometd.bayeux.Promise<Boolean> promise) longvoidremoveExtension(org.cometd.bayeux.server.BayeuxServer.Extension extension) voidremoveListener(org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener listener) protected booleanremoveServerChannel(ServerChannelImpl channel) booleanremoveServerSession(org.cometd.bayeux.server.ServerSession session, boolean timeout) booleanremoveSession(org.cometd.bayeux.server.ServerSession session) protected org.cometd.bayeux.Promise<Boolean> resolveLoop(org.cometd.common.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(org.cometd.bayeux.server.SecurityPolicy securityPolicy) voidsetSweepPeriod(long sweepPeriod) voidsetSweepThreads(int sweepThreads) voidsetTransports(List<org.cometd.bayeux.server.ServerTransport> transports) voidsetTransports(org.cometd.bayeux.server.ServerTransport... transports) voidsweep()protected voidunknownSession(org.cometd.bayeux.server.ServerMessage.Mutable reply) protected StringvalidateMessage(org.cometd.bayeux.server.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, installBean, installBean, 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 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:
-
SWEEP_THREADS_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:
-
CONTEXT_ATTRIBUTE_NAME_OPTION
- See Also:
-
-
Constructor Details
-
BayeuxServerImpl
public BayeuxServerImpl()
-
-
Method Details
-
getName
-
doStart
-
doStop
-
initializeMetaChannels
protected void initializeMetaChannels() -
initializeJSONContext
-
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
-
getOption
-
getOption
-
getOptionNames
-
setOption
-
setOptions
-
randomLong
public long randomLong() -
getSecurityPolicy
public org.cometd.bayeux.server.SecurityPolicy getSecurityPolicy()- Specified by:
getSecurityPolicyin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getJSONContext
-
createChannelIfAbsent
public org.cometd.bayeux.MarkedReference<org.cometd.bayeux.server.ServerChannel> createChannelIfAbsent(String channelName, org.cometd.bayeux.server.ConfigurableServerChannel.Initializer... initializers) - Specified by:
createChannelIfAbsentin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getSessions
- Specified by:
getSessionsin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getSession
- Specified by:
getSessionin interfaceorg.cometd.bayeux.server.BayeuxServer
-
addServerSession
public void addServerSession(ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage message) -
removeSession
public boolean removeSession(org.cometd.bayeux.server.ServerSession session) - Specified by:
removeSessionin interfaceorg.cometd.bayeux.server.BayeuxServer
-
removeServerSession
public boolean removeServerSession(org.cometd.bayeux.server.ServerSession session, boolean timeout) - 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 interfaceorg.cometd.bayeux.server.BayeuxServer
-
newMessage
public org.cometd.bayeux.server.ServerMessage.Mutable newMessage()- Specified by:
newMessagein interfaceorg.cometd.bayeux.server.BayeuxServer
-
newMessage
public org.cometd.bayeux.server.ServerMessage.Mutable newMessage(org.cometd.bayeux.server.ServerMessage original) -
setSecurityPolicy
public void setSecurityPolicy(org.cometd.bayeux.server.SecurityPolicy securityPolicy) - Specified by:
setSecurityPolicyin interfaceorg.cometd.bayeux.server.BayeuxServer
-
addExtension
public void addExtension(org.cometd.bayeux.server.BayeuxServer.Extension extension) - Specified by:
addExtensionin interfaceorg.cometd.bayeux.server.BayeuxServer
-
removeExtension
public void removeExtension(org.cometd.bayeux.server.BayeuxServer.Extension extension) - Specified by:
removeExtensionin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getExtensions
- Specified by:
getExtensionsin interfaceorg.cometd.bayeux.server.BayeuxServer
-
addListener
public void addListener(org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener listener) - Specified by:
addListenerin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getChannel
- Specified by:
getChannelin interfaceorg.cometd.bayeux.server.BayeuxServer
-
getChannels
- Specified by:
getChannelsin interfaceorg.cometd.bayeux.server.BayeuxServer
-
removeListener
public void removeListener(org.cometd.bayeux.server.BayeuxServer.BayeuxServerListener listener) - Specified by:
removeListenerin interfaceorg.cometd.bayeux.server.BayeuxServer
-
handle
public void handle(ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) -
validateMessage
-
publish
protected void publish(ServerSessionImpl session, ServerChannelImpl channel, org.cometd.bayeux.server.ServerMessage.Mutable message, boolean receiving, org.cometd.bayeux.Promise<Boolean> promise) -
resolveLoop
-
freeze
public void freeze(org.cometd.bayeux.server.ServerMessage.Mutable mutable) -
extendOutgoing
protected void extendOutgoing(org.cometd.bayeux.server.ServerSession sender, org.cometd.bayeux.server.ServerSession session, org.cometd.bayeux.server.ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise) -
extendReply
public void extendReply(ServerSessionImpl sender, ServerSessionImpl session, org.cometd.bayeux.server.ServerMessage.Mutable reply, org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise) -
removeServerChannel
-
getListeners
-
getKnownTransportNames
-
getTransport
- Specified by:
getTransportin interfaceorg.cometd.bayeux.Bayeux- Specified by:
getTransportin interfaceorg.cometd.bayeux.server.BayeuxServer
-
addTransport
public org.cometd.bayeux.server.ServerTransport addTransport(org.cometd.bayeux.server.ServerTransport transport) -
setTransports
public void setTransports(org.cometd.bayeux.server.ServerTransport... transports) -
setTransports
-
getTransports
-
getAllowedTransports
-
setAllowedTransports
-
setAllowedTransports
-
isBroadcastToPublisher
@ManagedAttribute(value="Whether this CometD server broadcast messages to the publisher", readonly=true) public boolean isBroadcastToPublisher() -
unknownSession
protected void unknownSession(org.cometd.bayeux.server.ServerMessage.Mutable reply) -
error
-
createReply
protected org.cometd.bayeux.server.ServerMessage.Mutable createReply(org.cometd.bayeux.server.ServerMessage.Mutable message) -
sweep
@ManagedOperation(value="Sweeps channels and sessions of this CometD server", impact="ACTION") public void sweep() -
asyncSweep
-
isDetailedDump
@ManagedAttribute("Reports additional details in the dump() operation") public boolean isDetailedDump() -
setDetailedDump
public void setDetailedDump(boolean detailedDump) -
getSweepPeriod
@ManagedAttribute("The period, in milliseconds, of the sweeping activity performed by the server") public long getSweepPeriod() -
setSweepPeriod
public void setSweepPeriod(long sweepPeriod) -
getSweepThreads
@ManagedAttribute("The maximum number of threads that can be used by the sweeping activity performed by the server") public int getSweepThreads() -
setSweepThreads
public void setSweepThreads(int sweepThreads) -
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Overrides:
dumpin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
IOException
-
getLastSweepInfo
-
getLongestSweepInfo
-