Class AbstractPrefetchInputStreamByteReceiver

All Implemented Interfaces:
org.refcodes.component.Closable, org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.ClosedAccessor, org.refcodes.component.ConnectableComponent, org.refcodes.component.ConnectableComponent.ConnectableAutomaton, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.OpenedAccessor, Availability, ByteDestination, ByteReceiver, BytesDestination, BytesReceiver, Receivable, Skippable, TimeoutInputStreamAccessor, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.Loggable
Direct Known Subclasses:
PrefetchBidirectionalStreamConnectionByteTransceiver, PrefetchInputStreamConnectionByteReceiver

public abstract class AbstractPrefetchInputStreamByteReceiver extends AbstractBytesReceiver implements org.refcodes.mixin.Loggable
Abstract implementation of the BytesReceiver interface. As of the prefetching functionality, a separate daemon thread (retrieved via an ExecutorService) reads from the provided InputStream and places the datagrams into a datagram queue until the datagram queue's capacity is reached. Datagrams are read by the AbstractBytesReceiver.receiveByte() (AbstractBytesReceiver.receiveAllBytes()) by them methods popping the datagrams from the datagram queue. If the queue is empty, then the AbstractBytesReceiver.receiveByte() ( AbstractBytesReceiver.receiveAllBytes()) method is blocked until the daemon thread places new datagrams into the queue.
See Also: