Package org.nuxeo.lib.stream.log.mem
Class MemLogAppender<M extends Externalizable>
java.lang.Object
org.nuxeo.lib.stream.log.mem.MemLogAppender<M>
- All Implemented Interfaces:
AutoCloseable
,CloseableLogAppender<M>
,LogAppender<M>
public class MemLogAppender<M extends Externalizable>
extends Object
implements CloseableLogAppender<M>
Memory implementation of LogAppender.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAppend a message into a partition, returnsLogOffset
position of the message.void
close()
boolean
closed()
Returnstrue
if the appender has been closed by the manager.createTailer
(LogPartition partition, Name group, Codec<M> codec) getCodec()
Returns the codec used to write record.name()
Returns the Log's name.int
size()
Returns the number of partitions in the Log.toString()
boolean
Wait for consumer to process a message up to the offset.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.nuxeo.lib.stream.log.LogAppender
append
-
Field Details
-
NOCODEC_TAG
- See Also:
-
-
Constructor Details
-
MemLogAppender
-
-
Method Details
-
name
Description copied from interface:LogAppender
Returns the Log's name.- Specified by:
name
in interfaceLogAppender<M extends Externalizable>
-
getCodec
Description copied from interface:LogAppender
Returns the codec used to write record. A null codec is the default legacy encoding.- Specified by:
getCodec
in interfaceLogAppender<M extends Externalizable>
-
closed
public boolean closed()Description copied from interface:LogAppender
Returnstrue
if the appender has been closed by the manager.- Specified by:
closed
in interfaceLogAppender<M extends Externalizable>
-
size
public int size()Description copied from interface:LogAppender
Returns the number of partitions in the Log.- Specified by:
size
in interfaceLogAppender<M extends Externalizable>
-
append
Description copied from interface:LogAppender
Append a message into a partition, returnsLogOffset
position of the message. This method is thread safe, a queue can be shared by multiple producers.- Specified by:
append
in interfaceLogAppender<M extends Externalizable>
- Parameters:
partition
- index lower thanLogAppender.size()
-
createTailer
-
waitFor
public boolean waitFor(LogOffset logOffset, Name group, Duration timeout) throws InterruptedException Description copied from interface:LogAppender
Wait for consumer to process a message up to the offset. The message is processed if a consumer of the group commits a greater or equals offset. Returntrue
if the message has been consumed,false
in case of timeout.- Specified by:
waitFor
in interfaceLogAppender<M extends Externalizable>
- Throws:
InterruptedException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableLogAppender<M extends Externalizable>
-
toString
-