public interface Transport
extends java.lang.AutoCloseable
Client
instance. There is usually no reason to make direct use of it.
Its functionality is best accessed via the client instance.Modifier and Type | Method and Description |
---|---|
Message |
allocateMessage() |
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 |
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 ml) |
void |
setTransportFilter(TransportFilter filter_)
Sets a TransportFilter that filters raw bytes before send and after receive.
|
long |
writeQueueSize() |
void connect(java.net.URI uri) throws ConnectionRefusedException, AlreadyConnectedException, InvalidURIException
uri
- 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.void disconnect()
void setMessageHandler(MessageHandler ml)
void setDisconnectHandler(TransportDisconnectHandler dh)
void setExceptionListener(java.beans.ExceptionListener exceptionListener)
void setThreadCreatedHandler(ThreadCreatedHandler ml)
void send(Message message) throws DisconnectedException
DisconnectedException
void sendWithoutRetry(Message message) throws DisconnectedException
DisconnectedException
Message allocateMessage()
long writeQueueSize() throws DisconnectedException
DisconnectedException
long readQueueSize() throws DisconnectedException
DisconnectedException
long flush() throws DisconnectedException
DisconnectedException
long flush(long timeout) throws DisconnectedException
DisconnectedException
void handleCloseEvent(int failedVersion_, java.lang.String message, java.lang.Exception e) throws DisconnectedException, RetryOperationException
int getVersion()
void setReadTimeout(int readTimeoutMillis_)
void setTransportFilter(TransportFilter filter_)
filter_
- A TransportFilter instance such as com.crankuptheamps.client.TransportTraceFilter.AMPSRunnable getIdleRunnable()
AMPSRunnable
that is invoked during idle-time
processing for this connection.void setIdleRunnable(AMPSRunnable runnable)
AMPSRunnable
that is invoked during idle-time processing for this connection.runnable
- A AMPSRunnable
instance whose run() method is invoked.void initFromClient(Client client)
client
- The Client that will be using the Transport.