public class BdbServerConnection
extends java.lang.Object
implements java.lang.AutoCloseable
BdbServerConnection is not thread-safe. Objects created from a connection use the connection internally, therefore they are not thread-safe either. A connection together with all objects created from it should only be accessed from a single thread. For example, a connection, an environment handle opened from it and a database handle opened from the environment handle, all three objects should be accessed from the same thread. It is an error to access the environment handle and the database handle from different threads.
Modifier and Type | Method and Description |
---|---|
BdbServerAdmin |
adminService()
Return a
BdbServerAdmin which can be used to perform
administrative operations on the connected server. |
void |
close()
Close this connection.
|
static BdbServerConnection |
connect(java.lang.String host,
int port)
Open a new connection to the specified BDB server.
|
static BdbServerConnection |
connectSsl(java.lang.String host,
int port,
SslConfig sslConfig,
int timeout)
Open a new SSL connection to the specified BDB server.
|
java.nio.ByteOrder |
getServerByteOrder()
Return the native byte order of the connected server.
|
default <V> V |
handleRuntimeExceptions(com.sleepycat.client.RemoteServiceCallable<V> remote) |
SEnvironment |
openEnvironment(java.lang.String home,
SEnvironmentConfig config)
Open a remote environment and return an environment handle.
|
default <V> V |
remoteCall(com.sleepycat.client.RemoteServiceCallable<V> remote) |
default <V> V |
remoteCallWithIOException(com.sleepycat.client.RemoteServiceCallable<V> remote) |
public static BdbServerConnection connect(java.lang.String host, int port) throws SDatabaseException
host
- the server's host URLport
- the server's listening portBdbConnectionException
- if an error occurred while connecting to
the serverSDatabaseException
- if any error occurspublic static BdbServerConnection connectSsl(java.lang.String host, int port, SslConfig sslConfig, int timeout) throws SDatabaseException
host
- the server's host URLport
- the server's listening portsslConfig
- the SSL configurationtimeout
- the timeout in milliseconds for each remote request, zero
as an infinite timeoutBdbConnectionException
- if an error occurred while connecting to
the serverSDatabaseException
- if any error occurspublic BdbServerAdmin adminService()
BdbServerAdmin
which can be used to perform
administrative operations on the connected server.public java.nio.ByteOrder getServerByteOrder()
public SEnvironment openEnvironment(java.lang.String home, SEnvironmentConfig config) throws java.io.IOException, SDatabaseException
home
- the environment's home directory. The directory must
specified as a relative pathconfig
- the environment attributes. If null, system default
attributes are usedjava.io.IOException
- if the environment does not exist or cannot be
accessedSResourceInUseException
- if the environment is being recovered or
deletedSDatabaseException
- if any error occurspublic void close()
After closing this connection, all objects created from this connection must be discarded.
close
in interface java.lang.AutoCloseable
public <V> V remoteCallWithIOException(com.sleepycat.client.RemoteServiceCallable<V> remote) throws java.io.IOException
java.io.IOException
public <V> V remoteCall(com.sleepycat.client.RemoteServiceCallable<V> remote)
public <V> V handleRuntimeExceptions(com.sleepycat.client.RemoteServiceCallable<V> remote) throws org.apache.thrift.TException
org.apache.thrift.TException
Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.