public class HttpPollingHandler extends Object implements TransportHandler, TransportStatistics
Modifier and Type | Field and Description |
---|---|
static int |
POLL_FREQUENCY_MS |
static int |
THROTTLE_TIME_MS |
EXTRA_URI_PARMS_RESOURCE, UNSUPPORTED_MESSAGE_NO_CLIENT_SUPPORT, UNSUPPORTED_MESSAGE_NO_SERVER_SUPPORT
Modifier and Type | Method and Description |
---|---|
void |
close()
Permanently closes this transport handler.
|
void |
configure(Message capabilitiesMessage)
Called to configure the transport.
|
long |
getConnectedTime() |
long |
getLastTransmissionTime() |
int |
getMeasuredLatency() |
int |
getMessagesReceived() |
int |
getMessagesSent() |
int |
getNextRequestNumber() |
int |
getPendingMessages() |
String |
getRxEndpoint() |
TransportStatistics |
getStatistics()
Returns the
TransportStatistics instance. |
String |
getTransportDescription() |
String |
getTxEndpoint() |
String |
getUnsupportedDescription() |
void |
handleProtocolExtension(Message message)
Allows extension to the standard ErraiBus Protocol by optionally handling any unknown protocol verbs from the
wire.
|
boolean |
isCancelled() |
boolean |
isFullDuplex() |
boolean |
isUsable()
Indicates whether the transport is usable.
|
static HttpPollingHandler |
newLongPollingInstance(ClientMessageBusImpl messageBus) |
static HttpPollingHandler |
newNoPollingInstance(ClientMessageBusImpl messageBus) |
static HttpPollingHandler |
newShortPollingInstance(ClientMessageBusImpl messageBus) |
void |
performPoll() |
com.google.gwt.http.client.Request |
sendPollingRequest(String payload,
Map<String,String> extraParameters,
com.google.gwt.http.client.RequestCallback callback)
Sends the given string oon the outbound communication channel (as a POST
request to the server).
|
void |
start()
Called to start the transport.
|
Collection<Message> |
stop(boolean stopAllCurrentRequests)
Called to stop the transport.
|
String |
toString() |
void |
transmit(List<Message> txMessages)
Transmits the specified list of
Message to the remote bus over the transport. |
public static int THROTTLE_TIME_MS
public static int POLL_FREQUENCY_MS
public static HttpPollingHandler newLongPollingInstance(ClientMessageBusImpl messageBus)
public static HttpPollingHandler newShortPollingInstance(ClientMessageBusImpl messageBus)
public static HttpPollingHandler newNoPollingInstance(ClientMessageBusImpl messageBus)
public void configure(Message capabilitiesMessage)
TransportHandler
configure
in interface TransportHandler
capabilitiesMessage
- the capabilities message from the message bus on handshake.public boolean isUsable()
TransportHandler
isUsable
in interface TransportHandler
public void start()
TransportHandler
start
in interface TransportHandler
public void transmit(List<Message> txMessages)
TransportHandler
Message
to the remote bus over the transport.transmit
in interface TransportHandler
txMessages
- a list of Message
to be transmitted.public void performPoll()
public Collection<Message> stop(boolean stopAllCurrentRequests)
TransportHandler
stop
in interface TransportHandler
stopAllCurrentRequests
- specifying true will cause any in-flight messages which have not returned to be immediately
cancelled.public boolean isCancelled()
public void handleProtocolExtension(Message message)
TransportHandler
handleProtocolExtension
in interface TransportHandler
public com.google.gwt.http.client.Request sendPollingRequest(String payload, Map<String,String> extraParameters, com.google.gwt.http.client.RequestCallback callback) throws com.google.gwt.http.client.RequestException
payload
- The message to send. It is sent verbatim.callback
- The callback to receive success or error notification. Note that
this callback IS NOT CALLED if the request is cancelled.extraParameters
- Extra paramets to include in the HTTP request (key is parameter name;
value is parameter value).com.google.gwt.http.client.RequestException
- if the request cannot be sent at all.public int getNextRequestNumber()
public TransportStatistics getStatistics()
TransportHandler
TransportStatistics
instance.getStatistics
in interface TransportHandler
public String getTransportDescription()
getTransportDescription
in interface TransportStatistics
public int getMessagesSent()
getMessagesSent
in interface TransportStatistics
public int getMessagesReceived()
getMessagesReceived
in interface TransportStatistics
public long getConnectedTime()
getConnectedTime
in interface TransportStatistics
public long getLastTransmissionTime()
getLastTransmissionTime
in interface TransportStatistics
public int getMeasuredLatency()
getMeasuredLatency
in interface TransportStatistics
public boolean isFullDuplex()
isFullDuplex
in interface TransportStatistics
public String getRxEndpoint()
getRxEndpoint
in interface TransportStatistics
public String getTxEndpoint()
getTxEndpoint
in interface TransportStatistics
public String getUnsupportedDescription()
getUnsupportedDescription
in interface TransportStatistics
public int getPendingMessages()
getPendingMessages
in interface TransportStatistics
public void close()
TransportHandler
close
in interface TransportHandler
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.