@ManagedObject(value="The CometD server") public class BayeuxServerImpl extends org.eclipse.jetty.util.component.ContainerLifeCycle implements BayeuxServer, org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
BayeuxServer.BayeuxServerListener, BayeuxServer.ChannelListener, BayeuxServer.Extension, BayeuxServer.SessionListener, BayeuxServer.SubscriptionListener
org.cometd.bayeux.Bayeux.BayeuxListener, org.cometd.bayeux.Bayeux.Validator
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
Modifier and Type | Field and Description |
---|---|
static String |
ALLOWED_TRANSPORTS_OPTION |
static String |
BROADCAST_TO_PUBLISHER_OPTION |
static String |
EXECUTOR_MAX_THREADS |
static String |
SCHEDULER_THREADS |
static String |
SWEEP_PERIOD_OPTION |
static String |
SWEEP_THREADS_OPTION |
static String |
TRANSPORTS_OPTION |
static String |
VALIDATE_MESSAGE_FIELDS_OPTION |
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
ATTRIBUTE
Constructor and Description |
---|
BayeuxServerImpl() |
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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dump, dump, dumpContainer, dumpIterable, dumpMapEntries, dumpObject, dumpObjects, dumpSelf, named
public static final String ALLOWED_TRANSPORTS_OPTION
public static final String SWEEP_PERIOD_OPTION
public static final String SWEEP_THREADS_OPTION
public static final String TRANSPORTS_OPTION
public static final String VALIDATE_MESSAGE_FIELDS_OPTION
public static final String BROADCAST_TO_PUBLISHER_OPTION
public static final String SCHEDULER_THREADS
public static final String EXECUTOR_MAX_THREADS
public String getName()
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 initializeMetaChannels()
protected void initializeServerTransports()
public void setExecutor(Executor executor)
public Executor getExecutor()
public void execute(Runnable job)
public void setScheduler(org.eclipse.jetty.util.thread.Scheduler scheduler)
public org.eclipse.jetty.util.thread.Scheduler getScheduler()
public org.eclipse.jetty.util.thread.Scheduler.Task schedule(Runnable task, long delay)
Entry point to schedule tasks in CometD.
Subclasses may override and run the task in a Executor
,
rather than in the scheduler thread.
task
- the task to scheduledelay
- the delay, in milliseconds, to run the taskpublic org.cometd.bayeux.ChannelId newChannelId(String id)
@ManagedOperation(value="The value of the given configuration option", impact="INFO") public Object getOption(@Name(value="optionName") String qualifiedName)
getOption
in interface org.cometd.bayeux.Bayeux
protected long getOption(String name, long dft)
protected boolean getOption(String name, boolean dft)
public Set<String> getOptionNames()
getOptionNames
in interface org.cometd.bayeux.Bayeux
public void setOption(String qualifiedName, Object value)
setOption
in interface org.cometd.bayeux.Bayeux
public long randomLong()
public SecurityPolicy getSecurityPolicy()
getSecurityPolicy
in interface BayeuxServer
public JSONContextServer getJSONContext()
public org.cometd.bayeux.MarkedReference<ServerChannel> createChannelIfAbsent(String channelName, ConfigurableServerChannel.Initializer... initializers)
createChannelIfAbsent
in interface BayeuxServer
public List<ServerSession> getSessions()
getSessions
in interface BayeuxServer
public ServerSession getSession(String clientId)
getSession
in interface BayeuxServer
protected void addServerSession(ServerSessionImpl session, ServerMessage message)
public boolean removeSession(ServerSession session)
removeSession
in interface BayeuxServer
public boolean removeServerSession(ServerSession session, boolean timeout)
session
- the session to removetimeout
- whether the session has been removed due to a timeoutpublic ServerSessionImpl newServerSession()
public LocalSession newLocalSession(String idHint)
newLocalSession
in interface BayeuxServer
public ServerMessage.Mutable newMessage()
newMessage
in interface BayeuxServer
public ServerMessage.Mutable newMessage(ServerMessage original)
public void setSecurityPolicy(SecurityPolicy securityPolicy)
setSecurityPolicy
in interface BayeuxServer
public void addExtension(BayeuxServer.Extension extension)
addExtension
in interface BayeuxServer
public void removeExtension(BayeuxServer.Extension extension)
removeExtension
in interface BayeuxServer
public List<BayeuxServer.Extension> getExtensions()
getExtensions
in interface BayeuxServer
public void addListener(BayeuxServer.BayeuxServerListener listener)
addListener
in interface BayeuxServer
public ServerChannel getChannel(String channelId)
getChannel
in interface BayeuxServer
public List<ServerChannel> getChannels()
getChannels
in interface BayeuxServer
public void removeListener(BayeuxServer.BayeuxServerListener listener)
removeListener
in interface BayeuxServer
public void handle(ServerSessionImpl session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise)
protected String validateMessage(ServerMessage.Mutable message)
protected void publish(ServerSessionImpl session, ServerChannelImpl channel, ServerMessage.Mutable message, boolean receiving, org.cometd.bayeux.Promise<Boolean> promise)
protected org.cometd.bayeux.Promise<Boolean> resolveLoop(AsyncFoldLeft.Loop<Boolean> loop)
public void freeze(ServerMessage.Mutable mutable)
protected void extendOutgoing(ServerSession sender, ServerSession session, ServerMessage.Mutable message, org.cometd.bayeux.Promise<Boolean> promise)
public void extendReply(ServerSessionImpl sender, ServerSessionImpl session, ServerMessage.Mutable reply, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise)
protected boolean removeServerChannel(ServerChannelImpl channel)
protected List<BayeuxServer.BayeuxServerListener> getListeners()
public Set<String> getKnownTransportNames()
getKnownTransportNames
in interface org.cometd.bayeux.Bayeux
public ServerTransport getTransport(String transport)
getTransport
in interface org.cometd.bayeux.Bayeux
public ServerTransport addTransport(ServerTransport transport)
public void setTransports(ServerTransport... transports)
public void setTransports(List<ServerTransport> transports)
public List<ServerTransport> getTransports()
protected AbstractHttpTransport findHttpTransport(javax.servlet.http.HttpServletRequest request)
@ManagedAttribute(value="The transports allowed by this CoemtD server", readonly=true) public List<String> getAllowedTransports()
getAllowedTransports
in interface org.cometd.bayeux.Bayeux
public void setAllowedTransports(String... allowed)
@ManagedAttribute(value="Whether this CometD server broadcast messages to the publisher", readonly=true) public boolean isBroadcastToPublisher()
protected void unknownSession(ServerMessage.Mutable reply)
protected void error(ServerMessage.Mutable reply, String error)
protected ServerMessage.Mutable createReply(ServerMessage.Mutable message)
@ManagedOperation(value="Sweeps channels and sessions of this CometD server", impact="ACTION") public void sweep()
@ManagedAttribute(value="Reports additional details in the dump() operation") public boolean isDetailedDump()
public void setDetailedDump(boolean detailedDump)
@ManagedAttribute(value="The period, in milliseconds, of the sweeping activity performed by the server") public long getSweepPeriod()
public void setSweepPeriod(long sweepPeriod)
@ManagedAttribute(value="The maximum number of threads that can be used by the sweeping activity performed by the server") public int getSweepThreads()
public void setSweepThreads(int sweepThreads)
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
Copyright © 2008–2023 The CometD Project. All rights reserved.