use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.QuorumPeerConfig in project tesb-rt-se by Talend.
the class ZookeeperServerImpl method getZookeeperServer.
public static ZookeeperServer getZookeeperServer(Properties props) throws Exception {
QuorumPeerConfig config = new QuorumPeerConfig();
config.parseProperties(props);
if (config.getServers().size() > 0) {
return new MyQuorumPeerMain(config);
} else {
return new MyZooKeeperServerMain(config);
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.QuorumPeerConfig in project thingsboard by thingsboard.
the class KafkaDemoClient method startZkLocal.
private static void startZkLocal() throws Exception {
final File zkTmpDir = File.createTempFile("zookeeper", "test");
if (zkTmpDir.delete() && zkTmpDir.mkdir()) {
Properties zkProperties = new Properties();
zkProperties.setProperty("dataDir", zkTmpDir.getAbsolutePath());
zkProperties.setProperty("clientPort", String.valueOf(ZK_PORT));
ServerConfig configuration = new ServerConfig();
QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
quorumConfiguration.parseProperties(zkProperties);
configuration.readFrom(quorumConfiguration);
new Thread() {
public void run() {
try {
new ZooKeeperServerMain().runFromConfig(configuration);
} catch (IOException e) {
System.out.println("Start of Local ZooKeeper Failed");
e.printStackTrace(System.err);
}
}
}.start();
} else {
System.out.println("Failed to delete or create data dir for Zookeeper");
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.QuorumPeerConfig in project zookeeper by apache.
the class ServerConfigTest method testJvmPauseMonitorConfigured.
@Test
public void testJvmPauseMonitorConfigured() {
final Long sleepTime = 444L;
final Long warnTH = 5555L;
final Long infoTH = 555L;
QuorumPeerConfig qpConfig = mock(QuorumPeerConfig.class);
when(qpConfig.isJvmPauseMonitorToRun()).thenReturn(true);
when(qpConfig.getJvmPauseSleepTimeMs()).thenReturn(sleepTime);
when(qpConfig.getJvmPauseWarnThresholdMs()).thenReturn(warnTH);
when(qpConfig.getJvmPauseInfoThresholdMs()).thenReturn(infoTH);
serverConfig.readFrom(qpConfig);
assertEquals(sleepTime, Long.valueOf(serverConfig.getJvmPauseSleepTimeMs()));
assertEquals(warnTH, Long.valueOf(serverConfig.getJvmPauseWarnThresholdMs()));
assertEquals(infoTH, Long.valueOf(serverConfig.getJvmPauseInfoThresholdMs()));
assertTrue(serverConfig.isJvmPauseMonitorToRun());
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.QuorumPeerConfig in project zookeeper by apache.
the class ServerConfig method parse.
/**
* Parse a ZooKeeper configuration file
* @param path the patch of the configuration file
* @throws ConfigException error processing configuration
*/
public void parse(String path) throws ConfigException {
QuorumPeerConfig config = new QuorumPeerConfig();
config.parse(path);
// let qpconfig parse the file and then pull the stuff we are
// interested in
readFrom(config);
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.QuorumPeerConfig in project zookeeper by apache.
the class JvmPauseMonitorTest method testJvmPauseMonitorExceedInfoThreshold.
@Test
@Timeout(value = 5)
public void testJvmPauseMonitorExceedInfoThreshold() throws InterruptedException {
QuorumPeerConfig qpConfig = mock(QuorumPeerConfig.class);
when(qpConfig.getJvmPauseSleepTimeMs()).thenReturn(sleepTime);
when(qpConfig.getJvmPauseInfoThresholdMs()).thenReturn(infoTH);
pauseMonitor = new JvmPauseMonitor(qpConfig);
pauseMonitor.serviceStart();
assertEquals(sleepTime, Long.valueOf(pauseMonitor.sleepTimeMs));
assertEquals(infoTH, Long.valueOf(pauseMonitor.infoThresholdMs));
while (pauseMonitor.getNumGcInfoThresholdExceeded() == 0) {
Thread.sleep(200);
}
}
Aggregations