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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend a message into a partition, returnsLogOffsetposition of the message.voidclose()booleanclosed()Returnstrueif 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.intsize()Returns the number of partitions in the Log.toString()booleanWait 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, waitMethods 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:LogAppenderReturns the Log's name.- Specified by:
namein interfaceLogAppender<M extends Externalizable>
-
getCodec
Description copied from interface:LogAppenderReturns the codec used to write record. A null codec is the default legacy encoding.- Specified by:
getCodecin interfaceLogAppender<M extends Externalizable>
-
closed
public boolean closed()Description copied from interface:LogAppenderReturnstrueif the appender has been closed by the manager.- Specified by:
closedin interfaceLogAppender<M extends Externalizable>
-
size
public int size()Description copied from interface:LogAppenderReturns the number of partitions in the Log.- Specified by:
sizein interfaceLogAppender<M extends Externalizable>
-
append
Description copied from interface:LogAppenderAppend a message into a partition, returnsLogOffsetposition of the message. This method is thread safe, a queue can be shared by multiple producers.- Specified by:
appendin 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:LogAppenderWait 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. Returntrueif the message has been consumed,falsein case of timeout.- Specified by:
waitForin interfaceLogAppender<M extends Externalizable>- Throws:
InterruptedException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableLogAppender<M extends Externalizable>
-
toString
-