public abstract class AbstractAsyncWriter<T> extends Object implements 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 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 String getThreadNamePrefix()
protected abstract void synchronouslyWrite(T item)
protected abstract void synchronouslyClose()
public void write(T item)
public void close()
close
in interface Closeable
close
in interface AutoCloseable