Package org.apache.curator.test
Class TestingZooKeeperServer
- java.lang.Object
-
- org.apache.curator.test.TestingZooKeeperServer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class TestingZooKeeperServer extends Object implements Closeable
Thanks to Jeremie BORDIER (ahfeel) for this code
-
-
Constructor Summary
Constructors Constructor Description TestingZooKeeperServer(QuorumConfigBuilder configBuilder)
TestingZooKeeperServer(QuorumConfigBuilder configBuilder, int thisInstanceIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
InstanceSpec
getInstanceSpec()
Collection<InstanceSpec>
getInstanceSpecs()
org.apache.zookeeper.server.quorum.QuorumPeer
getQuorumPeer()
void
kill()
void
restart()
Restart the server.void
start()
void
stop()
-
-
-
Constructor Detail
-
TestingZooKeeperServer
public TestingZooKeeperServer(QuorumConfigBuilder configBuilder)
-
TestingZooKeeperServer
public TestingZooKeeperServer(QuorumConfigBuilder configBuilder, int thisInstanceIndex)
-
-
Method Detail
-
getQuorumPeer
public org.apache.zookeeper.server.quorum.QuorumPeer getQuorumPeer()
-
getInstanceSpecs
public Collection<InstanceSpec> getInstanceSpecs()
-
kill
public void kill()
-
restart
public void restart() throws Exception
Restart the server. If the server is running it will be stopped and then started again. If it is not running (in a LATENT or STOPPED state) then it will be restarted. If it is in a CLOSED state then an exception will be thrown.- Throws:
Exception
-
stop
public void stop() throws IOException
- Throws:
IOException
-
getInstanceSpec
public InstanceSpec getInstanceSpec()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-