NodeIDType
- Consider using JSONMessenger any place you want to use this class.
The former subsumes this class and also has support for
MessagingTask objects.
This class exists primarily as a wrapper around NIOTransport to
support JSON messages. NIOTransport is for general-purpose NIO
byte stream communication between numbered nodes as specified by
the NodeConfig interface and a data processing worker as specified
by the DataProcessingWorker interface that handles byte arrays.
This class provides the abstraction of JSON messages and a
corresponding PacketDemultiplexer that handles JSON messages
instead of raw bytes.
Currently, there is no way to directly use NIOTransport other than
with MessageNIOTransport or JSONNIOTransport.public class JSONNIOTransport<NodeIDType> extends MessageNIOTransport<NodeIDType,org.json.JSONObject>
NIOTransport.AlternatingByteBuffer
NIO_CHARSET_ENCODING, RCVR_ADDRESS_FIELD, RCVR_IP_FIELD, RCVR_PORT_FIELD, SNDR_ADDRESS_FIELD, SNDR_IP_FIELD, SNDR_PORT_FIELD
DEFAULT_SSL_MODE, MAX_PAYLOAD_SIZE, MAX_QUEUED_SENDS, MIN_INTER_CONNECT_TIME, myID, nodeConfig, worker, WRITE_BUFFER_SIZE
Constructor and Description |
---|
JSONNIOTransport(NodeIDType id,
NodeConfig<NodeIDType> nodeConfig)
Initiates transporter with id and nodeConfig.
|
JSONNIOTransport(NodeIDType id,
NodeConfig<NodeIDType> nodeConfig,
AbstractPacketDemultiplexer<?> pd,
boolean start) |
JSONNIOTransport(NodeIDType id,
NodeConfig<NodeIDType> nodeConfig,
AbstractPacketDemultiplexer<?> pd,
SSLDataProcessingWorker.SSL_MODES sslMode) |
JSONNIOTransport(NodeIDType id,
NodeConfig<NodeIDType> nodeConfig,
SSLDataProcessingWorker.SSL_MODES sslMode) |
addPacketDemultiplexer, getMyID, getNodeConfig, getReceiverAddress, getReceiverAddress, getReceiverAddressJSONSmart, getSenderAddress, getSenderAddress, getSenderAddressAsString, getSenderAddressJSONSmart, getSenderInetAddress, main, precedePacketDemultiplexer, sendToAddress, sendToAddress, sendToID, sendToID, sendToIDInternal, setName, stop
cleanup, getCompression, getCompressionThreshold, getListeningAddress, getListeningPort, getListeningSocketAddress, getLogger, getNodeAddress, getNodePort, getPayloadLength, getPendingSize, getSSLMode, handshakeComplete, isDisconnected, isStarted, isStopped, outOfRange, run, send, send, send, setCompression, setCompressionThreshold, setMaxQueuedSends, setMinInterConnectTime, setUseSenderTask, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getListeningSocketAddress, getSSLMode, isDisconnected, isStopped
public JSONNIOTransport(NodeIDType id, NodeConfig<NodeIDType> nodeConfig) throws java.io.IOException
id
- My node ID.nodeConfig
- A map from all nodes' IDs to their respective socket
addresses.java.io.IOException
public JSONNIOTransport(NodeIDType id, NodeConfig<NodeIDType> nodeConfig, SSLDataProcessingWorker.SSL_MODES sslMode) throws java.io.IOException
id
- nodeConfig
- sslMode
- java.io.IOException
public JSONNIOTransport(NodeIDType id, NodeConfig<NodeIDType> nodeConfig, AbstractPacketDemultiplexer<?> pd, boolean start) throws java.io.IOException
id
- My node ID.nodeConfig
- A map from all nodes' IDs to their respective socket
addresses.pd
- The packet demultiplexer to handle received messages.start
- If a server thread must be automatically started upon
construction. If false, the caller must explicitly invoke (new
Thread(JSONNIOTransport)).start() to start the server.java.io.IOException
public JSONNIOTransport(NodeIDType id, NodeConfig<NodeIDType> nodeConfig, AbstractPacketDemultiplexer<?> pd, SSLDataProcessingWorker.SSL_MODES sslMode) throws java.io.IOException
id
- nodeConfig
- pd
- sslMode
- java.io.IOException