public abstract class AbstractPrefetchInputStreamByteReceiver extends AbstractByteReceiver
ByteReceiver 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 AbstractByteReceiver.readDatagram() (AbstractByteReceiver.readDatagrams())
by them methods popping the datagrams from the datagram queue.
If the queue is empty, then the AbstractByteReceiver.readDatagram() (
AbstractByteReceiver.readDatagrams()) method is blocked until the daemon thread places
new datagrams into the queue.AbstractByteReceiverAbstractByteReceiver.ConnectableAutomatonorg.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedPropertyorg.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>_automaton_datagramQueue, DATAGRAM_QUEUE_SIZE| Constructor and Description |
|---|
AbstractPrefetchInputStreamByteReceiver()
Creates an
AbstractPrefetchInputStreamByteReceiver. |
AbstractPrefetchInputStreamByteReceiver(ExecutorService aExecutorService)
Creates an
AbstractPrefetchInputStreamByteReceiver using the
given ExecutorService required for thread generation in an JEE
environment. |
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. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected boolean |
isOpenable(InputStream aInputStream)
Checks if is openable.
|
protected void |
open(InputStream aInputStream)
Open, see also
ConnectionOpenable.open(Object). |
getConnectionStatus, hasDatagram, isClosable, isClosed, isOpenable, isOpened, open, readDatagram, readDatagrams, readDatagrams, releaseAll, setConnectionStatuspushDatagram, pushDatagrams, pushDatagramspublic 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 AbstractByteReceiver.readDatagram() (
AbstractByteReceiver.readDatagrams()).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 AbstractByteReceiver.readDatagram() (
AbstractByteReceiver.readDatagrams()).aExecutorService - The ExecutorService to be used, when null
then an ExecutorService something line
Executors.newCachedThreadPool() is then retrieved.public void close()
throws org.refcodes.component.CloseException
close in interface org.refcodes.component.Closableclose in class AbstractByteReceiverorg.refcodes.component.CloseExceptionprotected void open(InputStream aInputStream) throws org.refcodes.component.OpenException
ConnectionOpenable.open(Object).aInputStream - the a input streamorg.refcodes.component.OpenException - the open exceptionprotected boolean isOpenable(InputStream aInputStream)
ConnectionOpenable.ConnectionOpenAutomaton.isOpenable(Object).aInputStream - the a input streamCopyright © 2017. All rights reserved.