public class RollingRandomAccessFileManager extends RollingFileManager
ByteBuffer and a
RandomAccessFile to do the I/O.| Modifier and Type | Class and Description |
|---|---|
private static class |
RollingRandomAccessFileManager.FactoryData
Factory data.
|
private static class |
RollingRandomAccessFileManager.RollingRandomAccessFileManagerFactory
Factory to create a RollingRandomAccessFileManager.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size.
|
private static RollingRandomAccessFileManager.RollingRandomAccessFileManagerFactory |
FACTORY |
private java.lang.ThreadLocal<java.lang.Boolean> |
isEndOfBatch |
private java.io.RandomAccessFile |
randomAccessFile |
sizebyteBuffer, layoutcount, LOGGER| Constructor and Description |
|---|
RollingRandomAccessFileManager(LoggerContext loggerContext,
java.io.RandomAccessFile raf,
java.lang.String fileName,
java.lang.String pattern,
java.io.OutputStream os,
boolean append,
boolean immediateFlush,
int bufferSize,
long size,
long time,
TriggeringPolicy policy,
RolloverStrategy strategy,
java.lang.String advertiseURI,
Layout<? extends java.io.Serializable> layout,
boolean writeHeader) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
closeOutputStream() |
protected void |
createFileAfterRollover() |
void |
flush()
Flushes any buffers.
|
int |
getBufferSize()
Returns the buffer capacity.
|
static RollingRandomAccessFileManager |
getRollingRandomAccessFileManager(java.lang.String fileName,
java.lang.String filePattern,
boolean isAppend,
boolean immediateFlush,
int bufferSize,
TriggeringPolicy policy,
RolloverStrategy strategy,
java.lang.String advertiseURI,
Layout<? extends java.io.Serializable> layout,
Configuration configuration) |
java.lang.Boolean |
isEndOfBatch() |
void |
setEndOfBatch(boolean endOfBatch) |
void |
updateData(java.lang.Object data) |
protected void |
write(byte[] bytes,
int offset,
int length,
boolean immediateFlush)
Some output streams synchronize writes while others do not.
|
private void |
writeHeader()
Writes the layout's header to the file if it exists.
|
protected void |
writeToDestination(byte[] bytes,
int offset,
int length)
Overrides
OutputStreamManager.writeToDestination(byte[], int, int) to add support for file locking. |
checkRollover, getFileExtension, getFileManager, getFileName, getFileSize, getFileTime, getPatternProcessor, getRolloverStrategy, getTriggeringPolicy, initialize, isRenameEmptyFiles, releaseSub, rollover, setRenameEmptyFiles, setRolloverStrategy, setTriggeringPolicycreateOutputStream, getContentFormat, getFileManager, isAppend, isCreateOnDemand, isLockingdrain, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, hasOutputStream, isOpen, setOutputStream, skipFooter, write, write, write, writeFooterclose, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logWarn, release, stoppublic static final int DEFAULT_BUFFER_SIZE
private static final RollingRandomAccessFileManager.RollingRandomAccessFileManagerFactory FACTORY
private java.io.RandomAccessFile randomAccessFile
private final java.lang.ThreadLocal<java.lang.Boolean> isEndOfBatch
public RollingRandomAccessFileManager(LoggerContext loggerContext, java.io.RandomAccessFile raf, java.lang.String fileName, java.lang.String pattern, java.io.OutputStream os, boolean append, boolean immediateFlush, int bufferSize, long size, long time, TriggeringPolicy policy, RolloverStrategy strategy, java.lang.String advertiseURI, Layout<? extends java.io.Serializable> layout, boolean writeHeader)
private void writeHeader()
public static RollingRandomAccessFileManager getRollingRandomAccessFileManager(java.lang.String fileName, java.lang.String filePattern, boolean isAppend, boolean immediateFlush, int bufferSize, TriggeringPolicy policy, RolloverStrategy strategy, java.lang.String advertiseURI, Layout<? extends java.io.Serializable> layout, Configuration configuration)
public java.lang.Boolean isEndOfBatch()
public void setEndOfBatch(boolean endOfBatch)
protected void write(byte[] bytes,
int offset,
int length,
boolean immediateFlush)
OutputStreamManagerwrite in class RollingFileManagerbytes - The serialized Log event.offset - The offset into the byte array.length - The number of bytes to write.immediateFlush - flushes immediately after writing.protected void writeToDestination(byte[] bytes,
int offset,
int length)
FileManagerOutputStreamManager.writeToDestination(byte[], int, int) to add support for file locking.writeToDestination in class RollingFileManagerbytes - the array containing dataoffset - from where to writelength - how many bytes to writeprotected void createFileAfterRollover()
throws java.io.IOException
createFileAfterRollover in class RollingFileManagerjava.io.IOExceptionpublic void flush()
OutputStreamManagerflush in class OutputStreamManagerpublic boolean closeOutputStream()
closeOutputStream in class OutputStreamManagerpublic int getBufferSize()
getBufferSize in class FileManagerpublic void updateData(java.lang.Object data)
updateData in class RollingFileManager