public abstract class AbstractAsyncWriter<T>
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_QUEUE_SIZE |
Modifier | Constructor and Description |
---|---|
protected |
AbstractAsyncWriter(int queueSize)
Creates an AbstractAsyncWriter that will use the provided WriterRunnable to consume from the
internal queue and write records into the synchronous writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Attempts to finishing draining the queue and then calls synchronoslyClose() to allow implementation
to do any one time clean up.
|
protected abstract java.lang.String |
getThreadNamePrefix()
Returns the prefix to use when naming threads.
|
protected abstract void |
synchronouslyClose() |
protected abstract void |
synchronouslyWrite(T item) |
void |
write(T item)
Public method for sub-classes or ultimately consumers to put an item into the queue
to be written out.
|
public static final int DEFAULT_QUEUE_SIZE
protected AbstractAsyncWriter(int queueSize)
protected abstract java.lang.String getThreadNamePrefix()
protected abstract void synchronouslyWrite(T item)
protected abstract void synchronouslyClose()
public void write(T item)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable