public class Client.ClientHandler.TransportConnectionMeasurer extends java.lang.Object implements Transport
| Constructor and Description |
|---|
TransportConnectionMeasurer(Transport underlying) |
| Modifier and Type | Method and Description |
|---|---|
Message |
allocateMessage() |
void |
clear() |
void |
close() |
void |
connect(java.net.URI uri)
Connect to an AMPS server.
|
void |
disconnect() |
long |
flush() |
long |
flush(long timeout) |
AMPSRunnable |
getIdleRunnable()
Gets the
AMPSRunnable that is invoked during idle-time
processing for this connection. |
int |
getVersion() |
void |
handleCloseEvent(int failedVersion_,
java.lang.String message,
java.lang.Exception e) |
void |
initFromClient(Client client)
Called by Client before calling connect to give Transport access to any
information in the Client needed by the Transport such as message handler,
exceptionListener, etc.
|
long |
readQueueSize() |
void |
send(Message message) |
void |
sendWithoutRetry(Message message) |
void |
sendWithoutRetry(Message message,
boolean isBatch) |
void |
setBatchSend(int batchSendBytes,
int timeoutMillis,
boolean clear) |
void |
setDisconnectHandler(TransportDisconnectHandler dh) |
void |
setExceptionListener(java.beans.ExceptionListener exceptionListener) |
void |
setIdleRunnable(AMPSRunnable runnable)
Sets a
AMPSRunnable that is invoked during idle-time processing for this connection. |
void |
setMessageHandler(MessageHandler ml) |
void |
setReadTimeout(int readTimeoutMillis_) |
void |
setThreadCreatedHandler(ThreadCreatedHandler tch_) |
void |
setTransportFilter(TransportFilter tracer_)
Sets a TransportFilter that filters raw bytes before send and after receive.
|
boolean |
successfullyConnected() |
long |
writeQueueSize() |
public TransportConnectionMeasurer(Transport underlying)
public void clear()
public boolean successfullyConnected()
public void connect(java.net.URI uri)
throws ConnectionRefusedException,
AlreadyConnectedException,
InvalidURIException
Transportconnect in interface Transporturi - Specifies the protocol and address of the server.ConnectionRefusedException - The connection was refused by the server.AlreadyConnectedException - The transport is already connected to a server.InvalidURIException - The URI is invalid.public void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exceptionpublic void disconnect()
disconnect in interface Transportpublic void setMessageHandler(MessageHandler ml)
setMessageHandler in interface Transportpublic void setDisconnectHandler(TransportDisconnectHandler dh)
setDisconnectHandler in interface Transportpublic void setExceptionListener(java.beans.ExceptionListener exceptionListener)
setExceptionListener in interface Transportpublic void setThreadCreatedHandler(ThreadCreatedHandler tch_)
setThreadCreatedHandler in interface Transportpublic void send(Message message) throws DisconnectedException
send in interface TransportDisconnectedExceptionpublic void sendWithoutRetry(Message message) throws DisconnectedException
sendWithoutRetry in interface TransportDisconnectedExceptionpublic void sendWithoutRetry(Message message, boolean isBatch) throws DisconnectedException
DisconnectedExceptionpublic Message allocateMessage()
allocateMessage in interface Transportpublic long writeQueueSize()
throws DisconnectedException
writeQueueSize in interface TransportDisconnectedExceptionpublic long readQueueSize()
throws DisconnectedException
readQueueSize in interface TransportDisconnectedExceptionpublic long flush()
throws DisconnectedException
flush in interface TransportDisconnectedExceptionpublic long flush(long timeout)
throws DisconnectedException
flush in interface TransportDisconnectedExceptionpublic void handleCloseEvent(int failedVersion_,
java.lang.String message,
java.lang.Exception e)
throws DisconnectedException,
RetryOperationException
handleCloseEvent in interface TransportDisconnectedExceptionRetryOperationExceptionpublic int getVersion()
getVersion in interface Transportpublic void setReadTimeout(int readTimeoutMillis_)
setReadTimeout in interface Transportpublic void setTransportFilter(TransportFilter tracer_)
TransportsetTransportFilter in interface Transporttracer_ - A TransportFilter instance such as com.crankuptheamps.client.TransportTraceFilter.public AMPSRunnable getIdleRunnable()
TransportAMPSRunnable that is invoked during idle-time
processing for this connection.getIdleRunnable in interface Transportpublic void setIdleRunnable(AMPSRunnable runnable)
TransportAMPSRunnable that is invoked during idle-time processing for this connection.setIdleRunnable in interface Transportrunnable - A AMPSRunnable instance whose run() method is invoked.public void initFromClient(Client client)
TransportinitFromClient in interface Transportclient - The Client that will be using the Transport.public void setBatchSend(int batchSendBytes,
int timeoutMillis,
boolean clear)
throws DisconnectedException
DisconnectedException