Package net.snowflake.client.core
Class EventHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- net.snowflake.client.core.EventHandler
-
public class EventHandler extends Handler
- Author:
- jrosen
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DISABLE_DUMP_COMPR_PROP
protected static String
DISABLE_DUMPS_PROP
protected static long
FILE_EXPN_TIME_MS
protected static long
LOG_BUFFER_SIZE
protected static String
LOG_DUMP_COMP_EXT
protected static String
LOG_DUMP_FILE_EXT
protected static String
LOG_DUMP_FILE_NAME
protected static String
MAX_NUM_DUMP_FILES_PROP
protected static String
MAX_SIZE_DUMPS_MB_PROP
protected static String
THROTTLE_DURATION_PROP
protected static String
THROTTLE_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 void
cleanupSfDumps(boolean deleteOldest)
Function to remove old Snowflake Dump files to make room for new ones.void
close()
void
dumpLogBuffer(String identifier)
Dumps the contents of the in-memory log buffer to disk and clears the buffer.void
flush()
Flushes all eventBuffer entries.int
getBufferSize()
Returns current size of the event bufferlong
getLogBufferSize()
Returns the current size of the log buffervoid
publish(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.
-
-