Java Code Examples for org.apache.zookeeper.server.ServerConfig#getMinSessionTimeout()
The following examples show how to use
org.apache.zookeeper.server.ServerConfig#getMinSessionTimeout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZkTestServer.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Run from a ServerConfig. * @param config ServerConfig to use. * @throws IOException If there is a low-level I/O error. */ public void runFromConfig(ServerConfig config) throws IOException { ObjectReleaseTracker.track(this); log.info("Starting server"); try { // ZooKeeper maintains a static collection of AuthenticationProviders, so // we make sure the SASL provider is loaded so that it can be used in // subsequent tests. System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); // Note that this thread isn't going to be doing anything else, // so rather than spawning another thread, we will just call // run() in this thread. // create a file logger url from the command line args FileTxnSnapLog ftxn = new FileTxnSnapLog(config.getDataLogDir(), config.getDataDir()); zooKeeperServer = new ZooKeeperServer(ftxn, config.getTickTime(), config.getMinSessionTimeout(), config.getMaxSessionTimeout(), new TestZKDatabase(ftxn, limiter)); cnxnFactory = new TestServerCnxnFactory(limiter); cnxnFactory.configure(config.getClientPortAddress(), config.getMaxClientCnxns()); cnxnFactory.startup(zooKeeperServer); cnxnFactory.join(); if (violationReportAction != LimitViolationAction.IGNORE) { String limitViolations = limiter.reportLimitViolations(); if (!limitViolations.isEmpty()) { log.warn("Watch limit violations: {}", limitViolations); if (violationReportAction == LimitViolationAction.FAIL) { throw new AssertionError("Parallel watch limits violated"); } } } } catch (InterruptedException e) { // warn, but generally this is ok log.warn("Server interrupted", e); } }
Example 2
Source File: ZkStarter.java From incubator-pinot with Apache License 2.0 | 4 votes |
@Override public void runFromConfig(final ServerConfig config) throws IOException { ServerConfig newServerConfig = new ServerConfig() { public void parse(String[] args) { config.parse(args); } public void parse(String path) throws QuorumPeerConfig.ConfigException { config.parse(path); } public void readFrom(QuorumPeerConfig otherConfig) { config.readFrom(otherConfig); } public InetSocketAddress getClientPortAddress() { return config.getClientPortAddress(); } public String getDataDir() { return config.getDataDir(); } public String getDataLogDir() { return config.getDataLogDir(); } public int getTickTime() { return config.getTickTime(); } public int getMaxClientCnxns() { dataDir = getDataDir(); dataLogDir = getDataLogDir(); tickTime = getTickTime(); minSessionTimeout = getMinSessionTimeout(); maxSessionTimeout = getMaxSessionTimeout(); maxClientCnxns = 0; return 0; } public int getMinSessionTimeout() { return config.getMinSessionTimeout(); } public int getMaxSessionTimeout() { return config.getMaxSessionTimeout(); } }; newServerConfig.getMaxClientCnxns(); super.runFromConfig(newServerConfig); }