Interface ZooKeeperServerEmbedded
- All Superinterfaces:
AutoCloseable
This API allows you to start a ZooKeeper server node from Java code
The server will run inside the same process.
Typical usecases are:
- Running automated tests
- Launch ZooKeeper server with a Java based service management system
Please take into consideration that in production usually it is better to not run the client together with the server in order to avoid race conditions, especially around how ephemeral nodes work.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilder for ZooKeeperServerEmbedded. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voidclose()Shutdown gracefully the server and wait for resources to be released.intGet client port for no secure connection.Get a connection string useful for the client.intGet client port for secure connection.voidstart()Start the server.voidstart(long startupTimeout) Start the server
-
Method Details
-
builder
-
start
-
start
-
getClientPort
int getClientPort()Get client port for no secure connection. -
getSecureClientPort
int getSecureClientPort()Get client port for secure connection. -
getConnectionString
-
getSecureConnectionString
-
close
void close()Shutdown gracefully the server and wait for resources to be released.- Specified by:
closein interfaceAutoCloseable
-