@ManagedObject(value="The CometD server") public class BayeuxServerImpl extends org.eclipse.jetty.util.component.AbstractLifeCycle 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
Bayeux.BayeuxListener
Modifier and Type | Field and Description |
---|---|
static String |
ALLOWED_TRANSPORTS_OPTION |
static String |
BROADCAST_TO_PUBLISHER_OPTION |
static String |
SWEEP_PERIOD_OPTION |
static String |
TRANSPORTS_OPTION |
static String |
VALIDATE_MESSAGE_FIELDS_OPTION |
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
ATTRIBUTE
Constructor and Description |
---|
BayeuxServerImpl() |
public static final String ALLOWED_TRANSPORTS_OPTION
public static final String SWEEP_PERIOD_OPTION
public static final String TRANSPORTS_OPTION
public static final String VALIDATE_MESSAGE_FIELDS_OPTION
public static final String BROADCAST_TO_PUBLISHER_OPTION
protected void doStart() throws Exception
doStart
in class org.eclipse.jetty.util.component.AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class org.eclipse.jetty.util.component.AbstractLifeCycle
Exception
protected void initializeMetaChannels()
protected void initializeServerTransports()
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 task@ManagedOperation(value="The value of the given configuration option", impact="INFO") public Object getOption(@Name(value="optionName") String qualifiedName)
protected long getOption(String name, long dft)
protected boolean getOption(String name, boolean dft)
public Set<String> getOptionNames()
getOptionNames
in interface Bayeux
public long randomLong()
public void setCurrentTransport(ServerTransport transport)
public ServerTransport getCurrentTransport()
getCurrentTransport
in interface BayeuxServer
public BayeuxContext getContext()
getContext
in interface BayeuxServer
public SecurityPolicy getSecurityPolicy()
getSecurityPolicy
in interface BayeuxServer
public JSONContext.Server getJSONContext()
public MarkedReference<ServerChannel> createChannelIfAbsent(String channelName, ConfigurableServerChannel.Initializer... initializers)
createChannelIfAbsent
in interface BayeuxServer
public List<ServerSession> getSessions()
getSessions
in interface BayeuxServer
public boolean removeSession(ServerSession session)
removeSession
in interface BayeuxServer
public ServerSession getSession(String clientId)
getSession
in interface BayeuxServer
protected void addServerSession(ServerSessionImpl session, ServerMessage message)
public boolean removeServerSession(ServerSession session, boolean timedOut)
session
- the session to removetimedOut
- whether the remove reason is server-side expirationprotected ServerSessionImpl newServerSession()
public LocalSession newLocalSession(String idHint)
newLocalSession
in interface BayeuxServer
public ServerMessage.Mutable newMessage()
newMessage
in interface BayeuxServer
public ServerMessage.Mutable newMessage(ServerMessage tocopy)
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 ServerMessage.Mutable handle(ServerSessionImpl session, ServerMessage.Mutable message)
protected void validateMessage(ServerMessage.Mutable message)
protected void doPublish(ServerSessionImpl from, ServerChannelImpl to, ServerMessage.Mutable mutable, boolean receiving)
public void freeze(ServerMessage.Mutable mutable)
public ServerMessage.Mutable extendReply(ServerSessionImpl from, ServerSessionImpl to, ServerMessage.Mutable reply)
protected boolean extendRecv(ServerSession from, ServerMessage.Mutable message)
protected boolean extendSend(ServerSession from, ServerSession to, ServerMessage.Mutable message)
protected boolean removeServerChannel(ServerChannelImpl channel)
protected List<BayeuxServer.BayeuxServerListener> getListeners()
public Set<String> getKnownTransportNames()
getKnownTransportNames
in interface Bayeux
public ServerTransport getTransport(String transport)
getTransport
in interface 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 server", readonly=true) public List<String> getAllowedTransports()
getAllowedTransports
in interface Bayeux
public void setAllowedTransports(String... allowed)
@ManagedAttribute(value="Whether this 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 BayeuxServer", impact="ACTION") public void sweep()
@ManagedAttribute(value="Reports additional details in the dump") public boolean isDetailedDump()
public void setDetailedDump(boolean detailedDump)
@ManagedOperation(value="Dumps the BayeuxServer state", impact="INFO") public String dump()
dump
in interface org.eclipse.jetty.util.component.Dumpable
public void dump(Appendable out, String indent) throws IOException
dump
in interface org.eclipse.jetty.util.component.Dumpable
IOException
Copyright © 2008–2017 The CometD Project. All rights reserved.