public abstract class EventsHandler<T> extends Object implements EventsStorageListener
| Modifier and Type | Field and Description |
|---|---|
protected Context |
context |
protected ScheduledExecutorService |
executor |
protected EventsStrategy<T> |
strategy
Thread safety guaranteed by accessing through executor.
|
| Constructor and Description |
|---|
EventsHandler(Context context,
EventsStrategy<T> strategy,
EventsFilesManager filesManager,
ScheduledExecutorService executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
disable() |
protected void |
executeAsync(Runnable runnable) |
protected void |
executeSync(Runnable runnable) |
protected abstract EventsStrategy<T> |
getDisabledEventsStrategy() |
void |
onRollOver(String rolledOverFile)
Triggered after an
EventsStorage rollOver event has successfully been completed |
void |
recordEventAsync(T event,
boolean sendImmediately) |
void |
recordEventSync(T event) |
protected final Context context
protected final ScheduledExecutorService executor
protected EventsStrategy<T> strategy
public EventsHandler(Context context,
EventsStrategy<T> strategy,
EventsFilesManager filesManager,
ScheduledExecutorService executor)
public void recordEventAsync(T event, boolean sendImmediately)
public void recordEventSync(T event)
public void onRollOver(String rolledOverFile)
EventsStorageListenerEventsStorage rollOver event has successfully been completedonRollOver in interface EventsStorageListenerrolledOverFile - file that was rolled over as part of this event; null
if a roll over event were triggered but it was determined that the current active file
is empty.public void disable()
protected abstract EventsStrategy<T> getDisabledEventsStrategy()
protected void executeSync(Runnable runnable)
protected void executeAsync(Runnable runnable)