Package org.jmxtrans.agent
Class RollingFileOutputWriter
java.lang.Object
org.jmxtrans.agent.AbstractOutputWriter
org.jmxtrans.agent.RollingFileOutputWriter
- All Implemented Interfaces:
OutputWriter
public class RollingFileOutputWriter extends AbstractOutputWriter
-
Field Summary
Fields Modifier and Type Field Description protected java.io.Filefileprotected booleanfirstResultprotected intmaxBackupIndexprotected longmaxFileSizestatic java.lang.StringSETTING_FILE_NAMEstatic java.lang.StringSETTING_FILE_NAME_DEFAULT_VALUEstatic java.lang.StringSETTING_MAX_BACKUP_INDEXstatic intSETTING_MAX_BACKUP_INDEX_DEFAULT_VALUEstatic java.lang.StringSETTING_MAX_FILE_SIZEstatic longSETTING_MAX_FILE_SIZE_DEFAULT_VALUEstatic java.lang.StringSETTING_SINGLE_LINEstatic booleanSETTING_SINGLE_LINE_DEFAULT_VALUEprotected booleansingleLineprotected java.io.FiletemporaryFileprotected java.io.WritertemporaryFileWriterFields inherited from class org.jmxtrans.agent.AbstractOutputWriter
logger, SETTING_LOG_LEVEL, SETTING_LOG_LEVEL_DEFAULT_VALUE -
Constructor Summary
Constructors Constructor Description RollingFileOutputWriter() -
Method Summary
Modifier and Type Method Description protected java.io.WritergetTemporaryFileWriter()voidpostCollect()called after a serie of writes, typically at the end of a collection.voidpostConstruct(java.util.Map<java.lang.String,java.lang.String> settings)voidpreCollect()Called before metrics collection startsprotected voidreleaseTemporaryWriter()voidwriteInvocationResult(java.lang.String invocationName, java.lang.Object value)voidwriteQueryResult(java.lang.String name, java.lang.String type, java.lang.Object value)Methods inherited from class org.jmxtrans.agent.AbstractOutputWriter
getDebugLevel, getInfoLevel, getTraceLevel, preDestroyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
SETTING_FILE_NAME
public static final java.lang.String SETTING_FILE_NAME- See Also:
- Constant Field Values
-
SETTING_FILE_NAME_DEFAULT_VALUE
public static final java.lang.String SETTING_FILE_NAME_DEFAULT_VALUE- See Also:
- Constant Field Values
-
SETTING_MAX_FILE_SIZE
public static final java.lang.String SETTING_MAX_FILE_SIZE- See Also:
- Constant Field Values
-
SETTING_MAX_FILE_SIZE_DEFAULT_VALUE
public static final long SETTING_MAX_FILE_SIZE_DEFAULT_VALUE- See Also:
- Constant Field Values
-
SETTING_MAX_BACKUP_INDEX
public static final java.lang.String SETTING_MAX_BACKUP_INDEX- See Also:
- Constant Field Values
-
SETTING_MAX_BACKUP_INDEX_DEFAULT_VALUE
public static final int SETTING_MAX_BACKUP_INDEX_DEFAULT_VALUE- See Also:
- Constant Field Values
-
SETTING_SINGLE_LINE
public static final java.lang.String SETTING_SINGLE_LINE- See Also:
- Constant Field Values
-
SETTING_SINGLE_LINE_DEFAULT_VALUE
public static final boolean SETTING_SINGLE_LINE_DEFAULT_VALUE- See Also:
- Constant Field Values
-
temporaryFileWriter
protected java.io.Writer temporaryFileWriter -
temporaryFile
protected java.io.File temporaryFile -
file
protected java.io.File file -
maxFileSize
protected long maxFileSize -
maxBackupIndex
protected int maxBackupIndex -
singleLine
protected boolean singleLine -
firstResult
protected boolean firstResult
-
-
Constructor Details
-
RollingFileOutputWriter
public RollingFileOutputWriter()
-
-
Method Details
-
postConstruct
public void postConstruct(java.util.Map<java.lang.String,java.lang.String> settings)- Specified by:
postConstructin interfaceOutputWriter- Overrides:
postConstructin classAbstractOutputWriter
-
getTemporaryFileWriter
protected java.io.Writer getTemporaryFileWriter() throws java.io.IOException- Throws:
java.io.IOException
-
writeInvocationResult
public void writeInvocationResult(java.lang.String invocationName, java.lang.Object value) throws java.io.IOException- Specified by:
writeInvocationResultin interfaceOutputWriter- Specified by:
writeInvocationResultin classAbstractOutputWriter- Throws:
java.io.IOException
-
writeQueryResult
public void writeQueryResult(@Nonnull java.lang.String name, @Nullable java.lang.String type, @Nullable java.lang.Object value) throws java.io.IOException- Specified by:
writeQueryResultin interfaceOutputWriter- Specified by:
writeQueryResultin classAbstractOutputWritertype- seeQuery.type- Throws:
java.io.IOException
-
releaseTemporaryWriter
protected void releaseTemporaryWriter() -
preCollect
public void preCollect() throws java.io.IOExceptionDescription copied from interface:OutputWriterCalled before metrics collection starts- Specified by:
preCollectin interfaceOutputWriter- Overrides:
preCollectin classAbstractOutputWriter- Throws:
java.io.IOException
-
postCollect
public void postCollect() throws java.io.IOExceptionDescription copied from interface:OutputWritercalled after a serie of writes, typically at the end of a collection.
Useful with batch writers.
- Specified by:
postCollectin interfaceOutputWriter- Overrides:
postCollectin classAbstractOutputWriter- Throws:
java.io.IOException
-