Async

class Async<T>

Result and callbacks for asynchronous connection, shift and terminal administration operations. Payments use TransactionHandle; pre-transactions use PreTransactionHandle.

The underlying operation has already started running on a background thread by the time this object is returned - registering onComplete/onException only attaches callbacks to it, it does not trigger anything:

terminal.connectAsync()
.onComplete(result -> ui.showConnected(result))
.onException(error -> ui.showError(error));

future exposes the same outcome as a plain CompletableFuture, so callers that want to wait synchronously can do so with future().join() (or .get()) instead of, or in addition to, registering onComplete/onException.

Functions

Link copied to clipboard

The underlying CompletableFuture, for callers that want to .join()/.get() instead.

Link copied to clipboard
fun onComplete(action: Consumer<T>): Async<T>

Called with the outcome once the operation completes.

Link copied to clipboard

Called instead of onComplete if the operation could not be completed.