public abstract class AbstractTransportMapping extends Object implements TransportMapping
AbstractTransportMapping provides an abstract
implementation for the message dispatcher list and the maximum inbound
message size.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
asyncMsgProcessingSupported |
protected int |
maxInboundMessageSize |
protected Vector |
transportListener |
| Constructor and Description |
|---|
AbstractTransportMapping() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMessageDispatcher(MessageDispatcher dispatcher)
Adds a message dispatcher to the transport.
|
void |
addTransportListener(TransportListener l)
Adds a transport listener to the transport.
|
abstract void |
close()
Closes the transport an releases all bound resources synchronously.
|
protected void |
fireProcessMessage(Address address,
ByteBuffer buf) |
int |
getMaxInboundMessageSize()
Gets the maximum length of an incoming message that can be successfully
processed by this transport mapping implementation.
|
abstract Class |
getSupportedAddressClass()
Gets the
Address class that is this transport mapping
supports. |
boolean |
isAsyncMsgProcessingSupported()
Returns
true if asynchronous (multi-threaded) message
processing may be implemented. |
abstract void |
listen()
Listen for incoming messages.
|
void |
removeMessageDispatcher(MessageDispatcher dispatcher)
Removes a message dispatcher.
|
void |
removeTransportListener(TransportListener l)
Removes a transport listener.
|
abstract void |
sendMessage(Address address,
byte[] message)
Sends a message to the supplied address using this transport.
|
void |
setAsyncMsgProcessingSupported(boolean asyncMsgProcessingSupported)
Specifies whether this transport mapping has to support asynchronous
messages processing or not.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetListenAddress, isListeningprotected Vector transportListener
protected int maxInboundMessageSize
protected boolean asyncMsgProcessingSupported
public abstract Class getSupportedAddressClass()
TransportMappingAddress class that is this transport mapping
supports.getSupportedAddressClass in interface TransportMappingAddress.public abstract void sendMessage(Address address, byte[] message) throws IOException
TransportMappingsendMessage in interface TransportMappingaddress - an Address instance denoting the target address.message - the whole message as an array of bytes.IOExceptionpublic void addMessageDispatcher(MessageDispatcher dispatcher)
TransportMappingaddMessageDispatcher in interface TransportMappingdispatcher - a MessageDispatcher instance.MessageDispatcherImplpublic void removeMessageDispatcher(MessageDispatcher dispatcher)
TransportMappingremoveMessageDispatcher in interface TransportMappingdispatcher - a previously added MessageDispatcher instance.TransportMapping.addMessageDispatcher(org.snmp4j.MessageDispatcher)public void addTransportListener(TransportListener l)
TransportMappingaddTransportListener in interface TransportMappingl - a TransportListener instance.public void removeTransportListener(TransportListener l)
TransportMappingTransportListener.removeTransportListener in interface TransportMappingl - a TransportListener instance.protected void fireProcessMessage(Address address, ByteBuffer buf)
public abstract void close()
throws IOException
TransportMappingclose in interface TransportMappingIOExceptionpublic abstract void listen()
throws IOException
TransportMappingTransportMapping.sendMessage(org.snmp4j.smi.Address, byte[]) is called for the
first time.listen in interface TransportMappingIOExceptionpublic int getMaxInboundMessageSize()
TransportMappinggetMaxInboundMessageSize in interface TransportMappingpublic boolean isAsyncMsgProcessingSupported()
true if asynchronous (multi-threaded) message
processing may be implemented. The default is true.false is returned the
MessageDispatcher.processMessage(org.snmp4j.TransportMapping, org.snmp4j.smi.Address, org.snmp4j.asn1.BERInputStream)
method must not return before the message has been entirely processed.public void setAsyncMsgProcessingSupported(boolean asyncMsgProcessingSupported)
asyncMsgProcessingSupported - if false the MessageDispatcher.processMessage(org.snmp4j.TransportMapping, org.snmp4j.smi.Address, org.snmp4j.asn1.BERInputStream)
method must not return before the message has been entirely processed,
because the incoming message buffer is not copied before the message
is being processed. If true the message buffer is copied
for each call, so that the message processing can be implemented
asynchronously.Copyright © 2014 SNMP4J.org. All rights reserved.