public class EventHandler extends Handler
| Modifier and Type | Field and 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 and Description |
|---|
EventHandler(int maxEntries,
int flushPeriodMs) |
| Modifier and Type | Method and 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 buffer
|
long |
getLogBufferSize()
Returns the current size of the log buffer
|
void |
publish(LogRecord record)
Overridden Logger.Handler publish(...) method.
|
void |
startFlusher()
Creates and runs a new QueueFlusher thread
|
void |
stopFlusher()
Stops the running QueueFlusher thread, if any
|
void |
triggerBasicEvent(Event.EventType type,
String message)
Triggers a new event of type @type with message @message and flushes
the eventBuffer if full
|
void |
triggerBasicEvent(Event.EventType type,
String message,
boolean flushBuffer)
Triggers a new BaseEvent of type @type with message @message and flushes
the eventBuffer if full or @flushBuffer is true
|
void |
triggerIncident(Map<String,Object> incidentInfo)
Triggers a new Incident with message @message and flushes the eventBuffer.
|
void |
triggerStateTransition(BasicEvent.QueryState newState,
String identifier)
Triggers a state transition event to @newState with an identifier
(eg, requestId, jobUUID, etc)
|
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevelprotected static final long LOG_BUFFER_SIZE
protected static final long FILE_EXPN_TIME_MS
protected static final String LOG_DUMP_FILE_NAME
protected static final String LOG_DUMP_FILE_EXT
protected static final String LOG_DUMP_COMP_EXT
protected static final String THROTTLE_DURATION_PROP
protected static final String THROTTLE_LIMIT_PROP
protected static final String DISABLE_DUMPS_PROP
protected static final String MAX_NUM_DUMP_FILES_PROP
protected static final String MAX_SIZE_DUMPS_MB_PROP
protected static final String DISABLE_DUMP_COMPR_PROP
public int getBufferSize()
public long getLogBufferSize()
public void startFlusher()
public void stopFlusher()
public void triggerBasicEvent(Event.EventType type, String message)
type - event typemessage - triggering messagepublic void triggerBasicEvent(Event.EventType type, String message, boolean flushBuffer)
type - event typemessage - trigger messageflushBuffer - true if push the event to flush bufferpublic void triggerStateTransition(BasicEvent.QueryState newState, String identifier)
newState - new stateidentifier - event idpublic void triggerIncident(Map<String,Object> incidentInfo)
incidentInfo - incident informationpublic void dumpLogBuffer(String identifier)
identifier - event idprotected void cleanupSfDumps(boolean deleteOldest)
deleteOldest - if true, always deletes the oldest file found if max
number of dump files has been reachedpublic void publish(LogRecord record)
Copyright © 2016. All rights reserved.