DATA
- The type of the datagram to be operated with. In case you wish
to use array types, you might better use the BlockReceiver
type.@FunctionalInterface public interface DatagramProvider<DATA extends Serializable>
DatagramProvider
is used to receive datagrams in a unified way.
The readDatagram()
method provides the next available datagram from
the counterpart DatagramConsumer
; in case there is none available.Modifier and Type | Method and Description |
---|---|
DATA |
readDatagram()
Reads (receives) the next datagram passed from a
DatagramSender
counterpart. |
DATA readDatagram() throws org.refcodes.component.OpenException, InterruptedException
DatagramSender
counterpart. In case none datagram is available, then this method blocks
until one is available. To prevent blocking, use the
#hasDatagram()
method to test beforehand whether a datagram is
available (in a multi-threaded usage scenario, #hasDatagram()
is
not a reliable indicator whether this method will block or not).
When a Thread
is waiting for a datagram to be read and
Thread.interrupt()
is being called, then the operation is aborted
and an InterruptedException
is thrown.DatagramSender
counterpart.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.InterruptedException
- Thrown when a Thread
is waiting,
sleeping, or otherwise occupied, and the Thread
is
interrupted, either before or during the activity.Copyright © 2017. All rights reserved.