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
PrefetchBidirectionalStreamConnectionByteTransceiver
, PrefetchInputStreamConnectionByteReceiver
public abstract class AbstractPrefetchInputStreamByteReceiver extends AbstractBytesReceiver implements org.refcodes.mixin.Loggable
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.AbstractBytesReceiver
AbstractBytesReceiver.ConnectableAutomaton
BytesReceiver.ReceiverInputStream
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<B extends org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<?>>, org.refcodes.mixin.InputStreamAccessor.InputStreamMutator, org.refcodes.mixin.InputStreamAccessor.InputStreamProperty
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<B extends TimeoutInputStreamAccessor.TimeoutInputStreamBuilder<?>>, TimeoutInputStreamAccessor.TimeoutInputStreamMutator, TimeoutInputStreamAccessor.TimeoutInputStreamProperty
_datagramQueue, DATAGRAM_QUEUE_SIZE
_automaton
Constructor | Description |
---|---|
AbstractPrefetchInputStreamByteReceiver() |
Creates an
AbstractPrefetchInputStreamByteReceiver . |
AbstractPrefetchInputStreamByteReceiver(int aQueueCapacity) |
Creates an
AbstractPrefetchInputStreamByteReceiver using the
given datagram queue capacity. |
AbstractPrefetchInputStreamByteReceiver(int aQueueCapacity,
ExecutorService aExecutorService) |
Creates an
AbstractPrefetchInputStreamByteReceiver using the
given ExecutorService required for thread generation in an JEE
environment. |
AbstractPrefetchInputStreamByteReceiver(ExecutorService aExecutorService) |
Creates an
AbstractPrefetchInputStreamByteReceiver using the
given ExecutorService required for thread generation in an JEE
environment. |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
protected boolean |
isOpenable(InputStream aInputStream) |
Checks if is openable.
|
protected void |
open(InputStream aInputStream) |
Open, see also
ConnectionOpenable.open(Object) . |
pushDatagram, pushDatagrams, pushDatagrams
available, getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, receiveAllBytes, receiveByte, receiveBytes, setConnectionStatus
hasAvailable
receiveBytes
getInputStream, getInputStream, receiveBytesWithin, receiveBytesWithin, receiveByteWithin, skip
closeIn, closeQuietly, closeUnchecked
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
skipAvailable, skipAvailableExcept, skipAvailableTill, skipAvailableTillSilenceFor, skipAvailableTillSilenceFor, skipAvailableWithin, skipAvailableWithin
public AbstractPrefetchInputStreamByteReceiver()
AbstractPrefetchInputStreamByteReceiver
.public AbstractPrefetchInputStreamByteReceiver(ExecutorService aExecutorService)
AbstractPrefetchInputStreamByteReceiver
using the
given ExecutorService
required for thread generation in an JEE
environment.aExecutorService
- The ExecutorService
to be used, when null
then an ExecutorService
something line
Executors.newCachedThreadPool()
is then retrieved.public AbstractPrefetchInputStreamByteReceiver(int aQueueCapacity)
AbstractPrefetchInputStreamByteReceiver
using the
given datagram queue capacity.aQueueCapacity
- The capacity of the prefetch queue before it blocks
until data is read via AbstractBytesReceiver.receiveByte()
(
AbstractBytesReceiver.receiveAllBytes()
).public AbstractPrefetchInputStreamByteReceiver(int aQueueCapacity, ExecutorService aExecutorService)
AbstractPrefetchInputStreamByteReceiver
using the
given ExecutorService
required for thread generation in an JEE
environment.aQueueCapacity
- The capacity of the prefetch queue before it blocks
until data is read via AbstractBytesReceiver.receiveByte()
(
AbstractBytesReceiver.receiveAllBytes()
).aExecutorService
- The ExecutorService
to be used, when null
then an ExecutorService
something line
Executors.newCachedThreadPool()
is then retrieved.public void close() throws IOException
close
in interface org.refcodes.component.Closable
close
in class AbstractBytesReceiver
IOException
protected void open(InputStream aInputStream) throws IOException
ConnectionOpenable.open(Object)
.aInputStream
- the input streamIOException
- the open exceptionprotected boolean isOpenable(InputStream aInputStream)
ConnectionOpenable.ConnectionOpenAutomaton.isOpenable(Object)
.aInputStream
- the input streamCopyright © 2021. All rights reserved.