public class Connection
extends java.lang.Object
implements java.lang.AutoCloseable
ConnectionFactory
. A connection can only run one transaction at a time, and nested
transactions are supported.Modifier and Type | Method and Description |
---|---|
void |
awaitClose()
Blocks until the connection has been closed.
|
void |
close()
Close the connection.
|
boolean |
isConnected()
Test to see if we're connected to the GoshawkDB node
|
<R> TransactionResult<R> |
runTransaction(TransactionFunction<R> fun)
Run a transaction.
|
public boolean isConnected()
public void awaitClose() throws java.lang.InterruptedException
java.lang.InterruptedException
- if an interruption occurs.public void close() throws java.lang.InterruptedException
close
in interface java.lang.AutoCloseable
java.lang.InterruptedException
- if an interruption occurs whilst we're waiting for the
connection to close.public <R> TransactionResult<R> runTransaction(TransactionFunction<R> fun)
R
- The type of the result of the transaction function.fun
- The transaction function to run. This will be automatically restarted as many
times as necessary until the transaction either commits or chooses to abort.