Class AbstractServerTransport
- All Implemented Interfaces:
ServerTransport,org.cometd.bayeux.Transport,org.eclipse.jetty.util.component.Dumpable
- Direct Known Subclasses:
AbstractHttpTransport
The base class of all server transports.
Each derived Transport class should declare all options that it supports
by calling AbstractTransport.setOption(String, Object) for each option.
Then during the call the init(), each transport should
call the variants of AbstractTransport.getOption(String) to obtained the configured
value for the option.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePerforms server-to-client transport operations when a/meta/connectmessage is held and a server-side message is published.Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractServerTransport(BayeuxServerImpl bayeux, String name) The constructor is passed theBayeuxServerImplinstance for the transport. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoiddestroy()voiddump(Appendable out, String indent) longprotected JSONContextServerlonglonglonglongvoidinit()Initializes the transport, resolving default and direct options.booleanbooleanbooleanlongprotected ServerMessage.Mutable[]parseMessages(BufferedReader reader, boolean jsonDebug) parseMessages(String json) voidprocessReply(ServerSessionImpl session, ServerMessage.Mutable reply, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) voidscheduleExpiration(ServerSessionImpl session, long metaConnectCycle) voidsetAllowMessageDeliveryDuringHandshake(boolean allow) voidsetHandshakeReconnect(boolean handshakeReconnect) voidsetInterval(long interval) voidsetMaxInterval(long maxInterval) voidsetMaxLazyTimeout(long maxLazyTimeout) voidsetMaxMessageSize(int maxMessageSize) voidsetMetaConnectDeliveryOnly(boolean meta) voidsetTimeout(long timeout) protected voidsweep()Housekeeping sweep, called a regular intervalsprotected StringtoJSON(ServerMessage msg) toString()Methods inherited from class org.cometd.common.AbstractTransport
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefixMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dump, dumpSelfMethods inherited from interface org.cometd.bayeux.Transport
getName, getOption, getOptionNames, getOptionPrefix
-
Field Details
-
TIMEOUT_OPTION
- See Also:
-
INTERVAL_OPTION
- See Also:
-
MAX_INTERVAL_OPTION
- See Also:
-
MAX_PROCESSING_OPTION
- See Also:
-
MAX_LAZY_TIMEOUT_OPTION
- See Also:
-
META_CONNECT_DELIVERY_OPTION
- See Also:
-
MAX_QUEUE_OPTION
- See Also:
-
JSON_CONTEXT_OPTION
- See Also:
-
HANDSHAKE_RECONNECT_OPTION
- See Also:
-
ALLOW_MESSAGE_DELIVERY_DURING_HANDSHAKE
- See Also:
-
MAX_MESSAGE_SIZE_OPTION
- See Also:
-
-
Constructor Details
-
AbstractServerTransport
The constructor is passed the
BayeuxServerImplinstance for the transport. TheBayeuxServerImpl.getOptions()map is populated with the default options known by this transport. The options are then inspected again wheninit()is called, to set the actual values used. The options are arranged into a naming hierarchy by derived classes adding prefix by calling addAbstractTransport.setOptionPrefix(String). Calls toAbstractTransport.getOption(String)will use the list of prefixes to search for the most specific option set.- Parameters:
bayeux- the BayeuxServer implementationname- the name of the transport
-
-
Method Details
-
newMetaConnectCycle
public long newMetaConnectCycle() -
getInterval
public long getInterval()- Specified by:
getIntervalin interfaceServerTransport- Returns:
- the interval in milliseconds
-
getMaxInterval
public long getMaxInterval()- Specified by:
getMaxIntervalin interfaceServerTransport- Returns:
- the maxInterval in milliseconds
-
getMaxLazyTimeout
public long getMaxLazyTimeout()- Specified by:
getMaxLazyTimeoutin interfaceServerTransport- Returns:
- the max lazy timeout in milliseconds before flushing lazy messages
-
getTimeout
public long getTimeout()- Specified by:
getTimeoutin interfaceServerTransport- Returns:
- the timeout in milliseconds
-
isMetaConnectDeliveryOnly
public boolean isMetaConnectDeliveryOnly()- Specified by:
isMetaConnectDeliveryOnlyin interfaceServerTransport
-
setMetaConnectDeliveryOnly
public void setMetaConnectDeliveryOnly(boolean meta) -
isHandshakeReconnect
public boolean isHandshakeReconnect() -
setHandshakeReconnect
public void setHandshakeReconnect(boolean handshakeReconnect) -
isAllowMessageDeliveryDuringHandshake
public boolean isAllowMessageDeliveryDuringHandshake() -
setAllowMessageDeliveryDuringHandshake
public void setAllowMessageDeliveryDuringHandshake(boolean allow) -
getMaxMessageSize
public long getMaxMessageSize() -
setMaxMessageSize
public void setMaxMessageSize(int maxMessageSize) -
init
public void init()Initializes the transport, resolving default and direct options. -
destroy
public void destroy() -
getJSONContextServer
-
parseMessages
protected ServerMessage.Mutable[] parseMessages(BufferedReader reader, boolean jsonDebug) throws ParseException, IOException - Throws:
ParseExceptionIOException
-
parseMessages
- Throws:
ParseException
-
getBayeux
- Returns:
- the BayeuxServer object
-
setInterval
public void setInterval(long interval) - Parameters:
interval- the interval in milliseconds
-
setMaxInterval
public void setMaxInterval(long maxInterval) - Parameters:
maxInterval- the maxInterval in milliseconds
-
setTimeout
public void setTimeout(long timeout) - Parameters:
timeout- the timeout in milliseconds
-
setMaxLazyTimeout
public void setMaxLazyTimeout(long maxLazyTimeout) - Parameters:
maxLazyTimeout- the maxLazyTimeout in milliseconds
-
sweep
protected void sweep()Housekeeping sweep, called a regular intervals -
processReply
public void processReply(ServerSessionImpl session, ServerMessage.Mutable reply, org.cometd.bayeux.Promise<ServerMessage.Mutable> promise) -
toJSON
-
allowMessageDeliveryDuringHandshake
-
scheduleExpiration
-
dump
- Specified by:
dumpin interfaceorg.eclipse.jetty.util.component.Dumpable- Throws:
IOException
-
toString
-