class ConcurrentCharLoader
extends java.lang.Object
implements java.lang.Runnable
CharBucket instances using a Reader in a separate threadConcurrentCharInputReader,
CharBucket,
Entry| Modifier and Type | Field and Description |
|---|---|
private boolean |
active |
private java.lang.Thread |
activeExecution |
private java.util.concurrent.ArrayBlockingQueue<java.lang.Object> |
buckets |
private Entry<CharBucket> |
currentBucket |
private CharBucket |
end |
private java.lang.Exception |
error |
private boolean |
finished |
private FixedInstancePool<CharBucket> |
instances |
(package private) BomInput.BytesProcessedNotification |
notification |
private java.io.Reader |
reader |
| Constructor and Description |
|---|
ConcurrentCharLoader(java.io.Reader reader,
int bucketSize,
int bucketQuantity)
Creates a
FixedInstancePool with a given amount of CharBucket instances and starts a thread to fill each one. |
| Modifier and Type | Method and Description |
|---|---|
CharBucket |
nextBucket()
Returns the next available bucket.
|
(package private) void |
reportError() |
void |
run()
The
CharBucket loading process that executes in parallel until the input is completely read. |
void |
stopReading()
Stops the
CharBucket loading process and closes the reader provided in the constructor of this class |
private final java.util.concurrent.ArrayBlockingQueue<java.lang.Object> buckets
private final CharBucket end
private final FixedInstancePool<CharBucket> instances
private Entry<CharBucket> currentBucket
private boolean finished
private boolean active
private final java.io.Reader reader
private final java.lang.Thread activeExecution
private java.lang.Exception error
BomInput.BytesProcessedNotification notification
public ConcurrentCharLoader(java.io.Reader reader,
int bucketSize,
int bucketQuantity)
FixedInstancePool with a given amount of CharBucket instances and starts a thread to fill each one.reader - The source of characters to extract and fill CharBucket instancesbucketSize - The size of each individual CharBucketbucketQuantity - The number of CharBucket instances used to extract characters from the given reader.public void run()
CharBucket loading process that executes in parallel until the input is completely read.
Once the end of the input is reached, the Reader instance provided in the constructor is closed.run in interface java.lang.Runnablepublic CharBucket nextBucket()
public void stopReading()
CharBucket loading process and closes the reader provided in the constructor of this classvoid reportError()