protected static class ReadBinLogIT.EventQueue extends Object implements com.github.shyiko.mysql.binlog.BinaryLogClient.EventListener
| Modifier and Type | Field and Description |
|---|---|
private Consumer<com.github.shyiko.mysql.binlog.event.Event> |
consumedEvents |
private long |
defaultTimeoutInMillis |
private Consumer<com.github.shyiko.mysql.binlog.event.Event> |
ignoredEvents |
private ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event> |
queue |
| Constructor and Description |
|---|
EventQueue(long defaultTimeoutInMillis,
Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents,
Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(int eventCount,
Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass)
Blocks until the listener has seen the specified number of events with the given type, or until the default timeout
has passed.
|
void |
consume(int eventCount,
Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass,
long timeoutMillis)
Blocks until the listener has seen the specified number of events with event data matching the specified class,
or until the specified time has passed.
|
void |
consume(int eventCount,
com.github.shyiko.mysql.binlog.event.EventType type)
Blocks until the listener has seen the specified number of events with the given type, or until the default timeout
has passed.
|
void |
consume(int eventCount,
com.github.shyiko.mysql.binlog.event.EventType type,
long timeoutMillis)
Blocks until the listener has seen the specified number of events with the given type, or until the specified time
has passed.
|
void |
consume(int eventCount,
long timeoutInMillis,
Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
Blocks until the listener has consume the specified number of matching events, blocking at most the specified number
of milliseconds.
|
void |
consume(int eventCount,
Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
Blocks until the listener has consume the specified number of matching events, blocking at most the default number of
milliseconds.
|
void |
consumeAll(long timeout,
TimeUnit unit)
Blocks for the specified amount of time, consuming (and discarding) all events.
|
private void |
defaultEventHandler(com.github.shyiko.mysql.binlog.event.Event event) |
void |
onEvent(com.github.shyiko.mysql.binlog.event.Event event) |
void |
reset()
Clear the queue.
|
private final ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event> queue
private final Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents
private final Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents
private final long defaultTimeoutInMillis
private void defaultEventHandler(com.github.shyiko.mysql.binlog.event.Event event)
public void onEvent(com.github.shyiko.mysql.binlog.event.Event event)
onEvent in interface com.github.shyiko.mysql.binlog.BinaryLogClient.EventListenerpublic void consumeAll(long timeout,
TimeUnit unit)
throws TimeoutException
timeout - the maximum amount of time that this method should blockunit - the time unit for timeoutTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
throws TimeoutException
eventCount - the number of eventscondition - the event-based predicate that signals a match; may not be nullTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
long timeoutInMillis,
Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
throws TimeoutException
eventCount - the number of eventstimeoutInMillis - the maximum amount of time in milliseconds that this method should blockcondition - the event-based predicate that signals a match; may not be nullTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
com.github.shyiko.mysql.binlog.event.EventType type)
throws TimeoutException
eventCount - the number of eventstype - the type of eventTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
com.github.shyiko.mysql.binlog.event.EventType type,
long timeoutMillis)
throws TimeoutException
eventCount - the number of eventstype - the type of eventtimeoutMillis - the maximum amount of time in milliseconds that this method should blockTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass)
throws TimeoutException
eventCount - the number of eventseventDataClass - the EventData subclassTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void consume(int eventCount,
Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass,
long timeoutMillis)
throws TimeoutException
eventCount - the number of eventseventDataClass - the EventData subclasstimeoutMillis - the maximum amount of time in milliseconds that this method should blockTimeoutException - if the waiting timed out before the expected number of events were receivedpublic void reset()
Copyright © 2018 JBoss by Red Hat. All rights reserved.