Package io.debezium.embedded
Class EmbeddedEngine.CompletionResult
- java.lang.Object
-
- io.debezium.embedded.EmbeddedEngine.CompletionResult
-
- All Implemented Interfaces:
EmbeddedEngine.CompletionCallback,io.debezium.engine.DebeziumEngine.CompletionCallback
- Enclosing class:
- EmbeddedEngine
public static class EmbeddedEngine.CompletionResult extends Object implements EmbeddedEngine.CompletionCallback
A callback function to be notified when the connector completes.
-
-
Field Summary
Fields Modifier and Type Field Description private CountDownLatchcompletedprivate EmbeddedEngine.CompletionCallbackdelegateprivate Throwableerrorprivate Stringmessageprivate booleansuccess
-
Constructor Summary
Constructors Constructor Description CompletionResult()CompletionResult(EmbeddedEngine.CompletionCallback delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Causes the current thread to wait until thecompletion occursor until the thread is interrupted.booleanawait(long timeout, TimeUnit unit)Causes the current thread to wait until thecompletion occurs, unless the thread is interrupted, or the specified waiting time elapses.Throwableerror()Get the completion error, if there is one.voidhandle(boolean success, String message, Throwable error)booleanhasCompleted()Determine if the connector has completed.booleanhasError()Determine if there is a completion error.Stringmessage()Get the completion message.booleansuccess()Get whether the connector completed normally.
-
-
-
Field Detail
-
delegate
private final EmbeddedEngine.CompletionCallback delegate
-
completed
private final CountDownLatch completed
-
success
private boolean success
-
message
private String message
-
error
private Throwable error
-
-
Constructor Detail
-
CompletionResult
public CompletionResult()
-
CompletionResult
public CompletionResult(EmbeddedEngine.CompletionCallback delegate)
-
-
Method Detail
-
handle
public void handle(boolean success, String message, Throwable error)- Specified by:
handlein interfaceio.debezium.engine.DebeziumEngine.CompletionCallback
-
await
public void await() throws InterruptedExceptionCauses the current thread to wait until thecompletion occursor until the thread is interrupted.This method returns immediately if the connector has completed already.
- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
await
public boolean await(long timeout, TimeUnit unit) throws InterruptedExceptionCauses the current thread to wait until thecompletion occurs, unless the thread is interrupted, or the specified waiting time elapses.This method returns immediately if the connector has completed already.
- Parameters:
timeout- the maximum time to waitunit- the time unit of thetimeoutargument- Returns:
trueif the completion was received, orfalseif the waiting time elapsed before the completion was received.- Throws:
InterruptedException- if the current thread is interrupted while waiting
-
hasCompleted
public boolean hasCompleted()
Determine if the connector has completed.- Returns:
trueif the connector has completed, orfalseif the connector is still running and this callback has not yet beennotified
-
success
public boolean success()
Get whether the connector completed normally.- Returns:
trueif the connector completed normally, orfalseif the connector produced an error that prevented startup or premature termination (or the connector has not yetcompleted)
-
message
public String message()
Get the completion message.- Returns:
- the completion message, or null if the connector has not yet
completed
-
error
public Throwable error()
Get the completion error, if there is one.- Returns:
- the completion error, or null if there is no error or connector has not yet
completed
-
hasError
public boolean hasError()
Determine if there is a completion error.- Returns:
trueif there is acompletion error, orfalseif there is no error or the connector has not yetcompleted
-
-