public class UdpOITransport extends OITransport
dataProvider, filedataProvider, node, pollingInterval
Constructor and Description |
---|
UdpOITransport(OINode oinode,
Factory factory)
Construct a new UdpOITransport to be used within the specified OINode.
|
UdpOITransport(OINode oinode,
Factory factory,
int prt)
Construct a new UdpOITransport to be used within the specified OINode.
|
Modifier and Type | Method and Description |
---|---|
protected void |
close()
Disconnect and close the socket.
|
protected void |
connect()
Create the socket and attempt to establish a connection.
|
void |
dataIsAvailable()
This method allows the transport's DataProvider to tell the transport
that data is waiting to be 'picked up'.
|
Factory |
getFactory()
Retrieve the Factory object used to create the DatagramPackets
|
java.net.DatagramSocket |
getSocket()
Retrieve the DatagramSocket object used to send/receive DatagramPackets
|
boolean |
isConnected()
Indicates whether this UdpOITransport is connected to the socket
|
boolean |
isDataAvailable()
Indicates whether data is available from the transport's DataProvider
|
boolean |
isProcessingData()
Indicates whether this UdpOITransport is currently processing data
|
boolean |
isRunning()
Indicates whether this UdpOITransport is running
|
boolean |
isWaitForReconnect()
Indicates whether this UdpOITransport is configured to, in the event
of a lost connection, wait for the connection to be re-established
before sending the data.
|
void |
processData(DCFieldContainer record)
Accept an
OIRecord object to be transmitted via UDP. |
void |
processData(DCFieldContainer[] records)
Accept some
OIRecord objects to be transmitted via UDP. |
protected void |
reconnect()
Attempt to re-establish the connection.
|
void |
run()
This method is used when the OITransport runs within its own thread.
|
void |
setFactory(Factory factory)
Set the Factory object used to create the DatagramPackets
|
protected void |
setProcessingData(boolean value)
Sets the boolean indicating whether the transport is currently
processing data.
|
protected void |
setRunning(boolean run)
Sets the boolean which indicates whether the transport is running
|
void |
setWaitForReconnect(boolean value)
Sets the boolean indicating whether the transport should, in the
event of a lost connection, wait for the connection to be
re-established before sending the current packet or drop the current
packet and move on to processing the next record.
|
void |
shutdown()
Stop the transport.
|
fileDataIsAvailable, getDataProvider, getFileDataProvider, getNode, getPollingInterval, getRealNarsOut, incrementOut, isHealthy, processEndOfFileData, processFileData, processFileData, processRejectFile, processStartOfFileData, setDataProvider, setFileDataProvider, setNode, setPollingInterval, setTransactionID
public UdpOITransport(OINode oinode, Factory factory) throws NodeStartException
oinode
- Reference to the OINode containing the transportfactory
- The Factory object used to create DatagramPackets
from the incoming OIRecords.NodeStartException
public UdpOITransport(OINode oinode, Factory factory, int prt) throws NodeStartException
oinode
- Reference to the OINode containing the transportfactory
- The Factory object used to create DatagramPackets
from the incoming OIRecords.prt
- The port number on which to create the socketNodeStartException
public void dataIsAvailable()
getData()
method and process it via the receiver's
processData()
method.dataIsAvailable
in interface DataReceiverIfc
dataIsAvailable
in class OITransport
public void processData(DCFieldContainer record) throws NodeProcessingException
OIRecord
object to be transmitted via UDP.processData
in interface DataReceiverIfc
processData
in class OITransport
record
- OIRecord
containing the data.NodeProcessingException
public void processData(DCFieldContainer[] records) throws NodeProcessingException
OIRecord
objects to be transmitted via UDP.
This method will block until the data can be successfully transmitted,
unless the transport is configured to drop records while the
connection is lost.records
- An array of OIRecord
objects.NodeProcessingException
public void run()
run
in interface java.lang.Runnable
run
in class OITransport
public void shutdown()
shutdown
in interface DCTransport
shutdown
in class OITransport
public void setFactory(Factory factory)
factory
- The Factory used to create the DatagramPacketspublic Factory getFactory()
public java.net.DatagramSocket getSocket()
protected void setRunning(boolean run)
public boolean isRunning()
public boolean isDataAvailable()
public boolean isProcessingData()
protected void setProcessingData(boolean value)
public boolean isWaitForReconnect()
true
, if transport will hold the current record
until the connection has been re-established. Otherwise,
the current record will be dropped and processing will
continue with the next record.public void setWaitForReconnect(boolean value)
public boolean isConnected()
protected void connect() throws java.io.IOException
java.io.IOException
protected void close()
protected void reconnect()