Package org.cometd.client.transport
Class ClientTransport
- java.lang.Object
-
- org.cometd.common.AbstractTransport
-
- org.cometd.client.transport.ClientTransport
-
- All Implemented Interfaces:
org.cometd.bayeux.Transport
- Direct Known Subclasses:
HttpClientTransport
public abstract class ClientTransport extends AbstractTransport
ClientTransports are used byBayeuxClientto send and receive Bayeux messages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceClientTransport.Factorystatic interfaceClientTransport.FailureHandlerstatic classClientTransport.FailureInfo
-
Field Summary
Fields Modifier and Type Field Description static StringJSON_CONTEXT_OPTIONstatic StringMAX_MESSAGE_SIZE_OPTIONstatic StringMAX_NETWORK_DELAY_OPTIONstatic StringSCHEDULER_OPTIONstatic StringURL_OPTION
-
Constructor Summary
Constructors Modifier Constructor Description protectedClientTransport(String name, String url, Map<String,Object> options)Deprecated.protectedClientTransport(String name, String url, Map<String,Object> options, ScheduledExecutorService scheduler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidabort(Throwable failure)Aborts this transport, usually by cancelling all pending Bayeux messages that require a response, such as/meta/connects, without waiting for a response.abstract booleanaccept(String version)protected StringgenerateJSON(List<org.cometd.bayeux.Message.Mutable> messages)protected JSONContext.ClientgetJSONContextClient()longgetMaxNetworkDelay()protected ScheduledExecutorServicegetScheduler()StringgetURL()voidinit()protected voidinitScheduler()protected List<org.cometd.bayeux.Message.Mutable>parseMessages(String content)abstract voidsend(TransportListener listener, List<org.cometd.bayeux.Message.Mutable> messages)protected voidsetMaxNetworkDelay(long maxNetworkDelay)voidsetURL(String url)protected voidshutdownScheduler()voidterminate()Terminates this transport, usually by closing network connections opened directly by this transport.-
Methods inherited from class org.cometd.common.AbstractTransport
getName, getOption, getOption, getOption, getOption, getOption, getOptionNames, getOptionPrefix, setOption, setOptionPrefix
-
-
-
-
Field Detail
-
URL_OPTION
public static final String URL_OPTION
- See Also:
- Constant Field Values
-
MAX_NETWORK_DELAY_OPTION
public static final String MAX_NETWORK_DELAY_OPTION
- See Also:
- Constant Field Values
-
JSON_CONTEXT_OPTION
public static final String JSON_CONTEXT_OPTION
- See Also:
- Constant Field Values
-
SCHEDULER_OPTION
public static final String SCHEDULER_OPTION
- See Also:
- Constant Field Values
-
MAX_MESSAGE_SIZE_OPTION
public static final String MAX_MESSAGE_SIZE_OPTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getURL
public String getURL()
-
setURL
public void setURL(String url)
-
init
public void init()
-
getJSONContextClient
protected JSONContext.Client getJSONContextClient()
-
initScheduler
protected void initScheduler()
-
shutdownScheduler
protected void shutdownScheduler()
-
getScheduler
protected ScheduledExecutorService getScheduler()
-
abort
public abstract void abort(Throwable failure)
Aborts this transport, usually by cancelling all pending Bayeux messages that require a response, such as/meta/connects, without waiting for a response.- Parameters:
failure- the cause of the abort- See Also:
BayeuxClient.abort()
-
terminate
public void terminate()
Terminates this transport, usually by closing network connections opened directly by this transport.- See Also:
ClientSession.disconnect()
-
accept
public abstract boolean accept(String version)
-
send
public abstract void send(TransportListener listener, List<org.cometd.bayeux.Message.Mutable> messages)
-
parseMessages
protected List<org.cometd.bayeux.Message.Mutable> parseMessages(String content) throws ParseException
- Throws:
ParseException
-
getMaxNetworkDelay
public long getMaxNetworkDelay()
-
setMaxNetworkDelay
protected void setMaxNetworkDelay(long maxNetworkDelay)
-
-