public class ChronicleLogAppender<M extends Externalizable> extends Object implements CloseableLogAppender<M>
Modifier and Type | Field and Description |
---|---|
protected File |
basePath |
protected boolean |
closed |
protected static int |
MAX_PARTITIONS |
protected String |
name |
protected int |
nbPartitions |
protected static String |
PARTITION_PREFIX |
protected List<net.openhft.chronicle.queue.ChronicleQueue> |
partitions |
protected static int |
POLL_INTERVAL_MS |
protected ChronicleRetentionDuration |
retention |
protected ConcurrentLinkedQueue<ChronicleLogTailer<M>> |
tailers |
Modifier | Constructor and Description |
---|---|
protected |
ChronicleLogAppender(File basePath,
int size,
ChronicleRetentionDuration retention) |
Modifier and Type | Method and Description |
---|---|
protected LogTailer<M> |
addTailer(ChronicleLogTailer<M> tailer) |
LogOffset |
append(int partition,
M message)
Append a message into a partition, returns
LogOffset position of the message. |
void |
close() |
boolean |
closed()
Returns
true if the appender has been closed by the manager. |
long |
countMessages(int partition,
long lowerOffset,
long upperOffset) |
static <M extends Externalizable> |
create(File basePath,
int size)
Create a new log.
|
static <M extends Externalizable> |
create(File basePath,
int size,
ChronicleRetentionDuration retention)
Create a new log
|
LogTailer<M> |
createTailer(LogPartition partition,
String group) |
long |
endOffset(int partition) |
protected static boolean |
exists(File basePath) |
protected int |
findNbQueues(File basePath) |
long |
firstOffset(int partition) |
String |
getBasePath() |
ChronicleRetentionDuration |
getRetention() |
protected void |
initPartitions() |
protected boolean |
isProcessed(ChronicleLogOffsetTracker tracker,
long offset) |
String |
name()
Returns the Log's name.
|
static <M extends Externalizable> |
open(File basePath)
Open an existing log.
|
static <M extends Externalizable> |
open(File basePath,
ChronicleRetentionDuration retention)
Open an existing log.
|
int |
size()
Returns the number of partitions in the Log.
|
String |
toString() |
boolean |
waitFor(LogOffset offset,
String group,
Duration timeout)
Wait for consumer to process a message up to the offset.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
append
protected static final String PARTITION_PREFIX
protected static final int POLL_INTERVAL_MS
protected static final int MAX_PARTITIONS
protected final List<net.openhft.chronicle.queue.ChronicleQueue> partitions
protected final int nbPartitions
protected final ConcurrentLinkedQueue<ChronicleLogTailer<M extends Externalizable>> tailers
protected final ChronicleRetentionDuration retention
protected volatile boolean closed
protected ChronicleLogAppender(File basePath, int size, ChronicleRetentionDuration retention)
protected void initPartitions()
public static <M extends Externalizable> ChronicleLogAppender<M> create(File basePath, int size, ChronicleRetentionDuration retention)
public static <M extends Externalizable> ChronicleLogAppender<M> create(File basePath, int size)
public static <M extends Externalizable> ChronicleLogAppender<M> open(File basePath)
public static <M extends Externalizable> ChronicleLogAppender<M> open(File basePath, ChronicleRetentionDuration retention)
public String getBasePath()
public String name()
LogAppender
name
in interface LogAppender<M extends Externalizable>
public int size()
LogAppender
size
in interface LogAppender<M extends Externalizable>
public LogOffset append(int partition, M message)
LogAppender
LogOffset
position of the message. This method is thread safe,
a queue can be shared by multiple producers.append
in interface LogAppender<M extends Externalizable>
partition
- index lower than LogAppender.size()
public LogTailer<M> createTailer(LogPartition partition, String group)
public long endOffset(int partition)
public long firstOffset(int partition)
public long countMessages(int partition, long lowerOffset, long upperOffset)
protected LogTailer<M> addTailer(ChronicleLogTailer<M> tailer)
public boolean waitFor(LogOffset offset, String group, Duration timeout) throws InterruptedException
LogAppender
true
if the message has been consumed, false
in case
of timeout.waitFor
in interface LogAppender<M extends Externalizable>
InterruptedException
public boolean closed()
LogAppender
true
if the appender has been closed by the manager.closed
in interface LogAppender<M extends Externalizable>
protected boolean isProcessed(ChronicleLogOffsetTracker tracker, long offset)
public void close()
close
in interface AutoCloseable
close
in interface CloseableLogAppender<M extends Externalizable>
protected int findNbQueues(File basePath)
public ChronicleRetentionDuration getRetention()
Copyright © 2018 Nuxeo. All rights reserved.