Package net.snowflake.client.core
Class EventHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- net.snowflake.client.core.EventHandler
-
public class EventHandler extends Handler
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDISABLE_DUMP_COMPR_PROPprotected static StringDISABLE_DUMPS_PROPprotected static longFILE_EXPN_TIME_MSprotected static longLOG_BUFFER_SIZEprotected static StringLOG_DUMP_COMP_EXTprotected static StringLOG_DUMP_FILE_EXTprotected static StringLOG_DUMP_FILE_NAMEprotected static StringMAX_NUM_DUMP_FILES_PROPprotected static StringMAX_SIZE_DUMPS_MB_PROPprotected static StringTHROTTLE_DURATION_PROPprotected static StringTHROTTLE_LIMIT_PROP
-
Constructor Summary
Constructors Constructor Description EventHandler(int maxEntries, int flushPeriodMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanupSfDumps(boolean deleteOldest)Function to remove old Snowflake Dump files to make room for new ones.voidclose()voiddumpLogBuffer(String identifier)Dumps the contents of the in-memory log buffer to disk and clears the buffer.voidflush()Flushes all eventBuffer entries.intgetBufferSize()Returns current size of the event bufferlonggetLogBufferSize()Returns the current size of the log buffervoidpublish(LogRecord record)Overridden Logger.Handler publish(...) method.-
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
-
-
-
Field Detail
-
LOG_BUFFER_SIZE
protected static final long LOG_BUFFER_SIZE
- See Also:
- Constant Field Values
-
FILE_EXPN_TIME_MS
protected static final long FILE_EXPN_TIME_MS
- See Also:
- Constant Field Values
-
LOG_DUMP_FILE_NAME
protected static final String LOG_DUMP_FILE_NAME
- See Also:
- Constant Field Values
-
LOG_DUMP_FILE_EXT
protected static final String LOG_DUMP_FILE_EXT
- See Also:
- Constant Field Values
-
LOG_DUMP_COMP_EXT
protected static final String LOG_DUMP_COMP_EXT
- See Also:
- Constant Field Values
-
THROTTLE_DURATION_PROP
protected static final String THROTTLE_DURATION_PROP
- See Also:
- Constant Field Values
-
THROTTLE_LIMIT_PROP
protected static final String THROTTLE_LIMIT_PROP
- See Also:
- Constant Field Values
-
DISABLE_DUMPS_PROP
protected static final String DISABLE_DUMPS_PROP
- See Also:
- Constant Field Values
-
MAX_NUM_DUMP_FILES_PROP
protected static final String MAX_NUM_DUMP_FILES_PROP
- See Also:
- Constant Field Values
-
MAX_SIZE_DUMPS_MB_PROP
protected static final String MAX_SIZE_DUMPS_MB_PROP
- See Also:
- Constant Field Values
-
DISABLE_DUMP_COMPR_PROP
protected static final String DISABLE_DUMP_COMPR_PROP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getBufferSize
public int getBufferSize()
Returns current size of the event buffer- Returns:
- size of eventBuffer
-
getLogBufferSize
public long getLogBufferSize()
Returns the current size of the log buffer- Returns:
- size of log buffer
-
dumpLogBuffer
public void dumpLogBuffer(String identifier)
Dumps the contents of the in-memory log buffer to disk and clears the buffer.- Parameters:
identifier- event id
-
cleanupSfDumps
protected void cleanupSfDumps(boolean deleteOldest)
Function to remove old Snowflake Dump files to make room for new ones.- Parameters:
deleteOldest- if true, always deletes the oldest file found if max number of dump files has been reached
-
publish
public void publish(LogRecord record)
Overridden Logger.Handler publish(...) method. Buffers unformatted log records in memory in a circular buffer-like fashion.
-
-