public interface ConnectionOrientedTransportMapping<A extends Address> extends TransportMapping<A>
Modifier and Type | Method and Description |
---|---|
void |
addTransportStateListener(TransportStateListener l)
Adds a transport state listener that is to be informed about connection
state changes.
|
boolean |
close(A remoteAddress)
Closes the connection to the given remote address (socket).
|
MessageLengthDecoder |
getMessageLengthDecoder()
Returns the
MessageLengthDecoder used by this transport
mapping. |
void |
removeTransportStateListener(TransportStateListener l)
Removes the supplied transport state listener.
|
boolean |
resumeAddress(A addressToResumeSending)
Resume sending of messages to the specified address.
|
void |
setConnectionTimeout(long connectionTimeout)
Sets the connection timeout.
|
void |
setMessageLengthDecoder(MessageLengthDecoder messageLengthDecoder)
Sets the
MessageLengthDecoder that decodes the total
message length from the header of a message. |
void |
suspendAddress(A addressToSuspendSending)
Suspend sending of messages to the specified address, regardless if a connection is already established or
not.
|
addTransportListener, close, getListenAddress, getMaxInboundMessageSize, getSupportedAddressClass, isListening, listen, removeTransportListener, sendMessage
MessageLengthDecoder getMessageLengthDecoder()
MessageLengthDecoder
used by this transport
mapping.void setMessageLengthDecoder(MessageLengthDecoder messageLengthDecoder)
MessageLengthDecoder
that decodes the total
message length from the header of a message.messageLengthDecoder
- a MessageLengthDecoder instance.void setConnectionTimeout(long connectionTimeout)
connectionTimeout
- the idle timeout in milliseconds. A zero or negative value will disable
any timeout and connections opened by this transport mapping will stay
opened until they are explicitly closed.void addTransportStateListener(TransportStateListener l)
l
- a TransportStateListener.void removeTransportStateListener(TransportStateListener l)
l
- a TransportStateListener.boolean close(A remoteAddress) throws IOException
remoteAddress
- the address of the remote socket.true
if the connection could be closed and
false
if the connection does not exists.IOException
- if closing the connection with the specified remote address
fails.boolean resumeAddress(A addressToResumeSending)
addressToResumeSending
- an arbitrary remote address for which any messages send by
TransportMapping.sendMessage(Address, byte[], TransportStateReference)
should be dropped before sending
and reopening a connection to that address.true
if the specified address was previously suspended and is now resumed to allow sending messages,
false
otherwise.void suspendAddress(A addressToSuspendSending)
TransportMapping.sendMessage(Address, byte[], TransportStateReference)
, call resumeAddress(A)
.addressToSuspendSending
- an arbitrary remote address for which any messages send by
TransportMapping.sendMessage(Address, byte[], TransportStateReference)
should be dropped before sending
and reopening a connection to that address.Copyright © 2022 SNMP4J.org. All rights reserved.