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 CountDownLatch
completed
private EmbeddedEngine.CompletionCallback
delegate
private Throwable
error
private String
message
private boolean
success
-
Constructor Summary
Constructors Constructor Description CompletionResult()
CompletionResult(EmbeddedEngine.CompletionCallback delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
await()
Causes the current thread to wait until thecompletion occurs
or until the thread is interrupted.boolean
await(long timeout, TimeUnit unit)
Causes the current thread to wait until thecompletion occurs
, unless the thread is interrupted, or the specified waiting time elapses.Throwable
error()
Get the completion error, if there is one.void
handle(boolean success, String message, Throwable error)
boolean
hasCompleted()
Determine if the connector has completed.boolean
hasError()
Determine if there is a completion error.String
message()
Get the completion message.boolean
success()
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:
handle
in interfaceio.debezium.engine.DebeziumEngine.CompletionCallback
-
await
public void await() throws InterruptedException
Causes the current thread to wait until thecompletion occurs
or 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 InterruptedException
Causes 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 thetimeout
argument- Returns:
true
if the completion was received, orfalse
if 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:
true
if the connector has completed, orfalse
if the connector is still running and this callback has not yet beennotified
-
success
public boolean success()
Get whether the connector completed normally.- Returns:
true
if the connector completed normally, orfalse
if 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:
true
if there is acompletion error
, orfalse
if there is no error or the connector has not yetcompleted
-
-