本文整理汇总了Java中org.apache.zookeeper.server.quorum.QuorumPeerConfig.getTickTime方法的典型用法代码示例。如果您正苦于以下问题:Java QuorumPeerConfig.getTickTime方法的具体用法?Java QuorumPeerConfig.getTickTime怎么用?Java QuorumPeerConfig.getTickTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.server.quorum.QuorumPeerConfig
的用法示例。
在下文中一共展示了QuorumPeerConfig.getTickTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startFakeCluster
import org.apache.zookeeper.server.quorum.QuorumPeerConfig; //导入方法依赖的package包/类
/**
* 启动伪集群模式
* @param config
* @throws IOException
* @throws InterruptedException
* @throws ConfigException
*/
public void startFakeCluster(QuorumPeerConfig config) throws IOException{
ServerCnxnFactory cnxnFactory = new NIOServerCnxnFactory();
cnxnFactory.configure(config.getClientPortAddress(), config.getMaxClientCnxns());
QuorumPeer quorumPeer = new QuorumPeer(config.getServers(), config.getDataDir(), config.getDataLogDir(), config.getElectionAlg(), config.getServerId(), config.getTickTime(), config.getInitLimit(), config.getSyncLimit(), config.getQuorumListenOnAllIPs(), cnxnFactory, config.getQuorumVerifier());
quorumPeer.setClientAddress(config.getClientPortAddress());
quorumPeer.setTxnFactory(new FileTxnSnapLog(config.getDataLogDir(), config.getDataDir()));
quorumPeer.setElectionType(config.getElectionAlg());
quorumPeer.setMyid(config.getServerId());
quorumPeer.setTickTime(config.getTickTime());
quorumPeer.setMinSessionTimeout(config.getMinSessionTimeout());
quorumPeer.setMaxSessionTimeout(config.getMaxSessionTimeout());
quorumPeer.setInitLimit(config.getInitLimit());
quorumPeer.setSyncLimit(config.getSyncLimit());
quorumPeer.setQuorumVerifier(config.getQuorumVerifier(), true);
quorumPeer.setCnxnFactory(cnxnFactory);
quorumPeer.setZKDatabase(new ZKDatabase(quorumPeer.getTxnFactory()));
quorumPeer.setLearnerType(config.getPeerType());
quorumPeer.setSyncEnabled(config.getSyncEnabled());
quorumPeer.setQuorumListenOnAllIPs(config.getQuorumListenOnAllIPs());
quorumPeer.start();
LOGGER.info("ZkServerCluster Started! ClientPortAddress={}", config.getClientPortAddress());
}
示例2: SpliceZoo
import org.apache.zookeeper.server.quorum.QuorumPeerConfig; //导入方法依赖的package包/类
public SpliceZoo(QuorumPeerConfig config, int number) throws IOException {
this.config = config;
ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory();
cnxnFactory.configure(config.getClientPortAddress(),config.getMaxClientCnxns());
peer = new QuorumPeer(config.getServers(), null, null, config.getElectionAlg(),
number, config.getTickTime(), config.getInitLimit(), config.getSyncLimit(), cnxnFactory);
peer.setClientPortAddress(config.getClientPortAddress());
peer.setTxnFactory(new FileTxnSnapLog(new File(config.getDataLogDir()),
new File(config.getDataDir())));
peer.setQuorumPeers(config.getServers());
peer.setElectionType(config.getElectionAlg());
peer.setMyid(config.getServerId());
peer.setTickTime(config.getTickTime());
peer.setMinSessionTimeout(config.getMinSessionTimeout());
peer.setMaxSessionTimeout(config.getMaxSessionTimeout());
peer.setInitLimit(config.getInitLimit());
peer.setSyncLimit(config.getSyncLimit());
peer.setQuorumVerifier(config.getQuorumVerifier());
peer.setCnxnFactory(cnxnFactory);
peer.setZKDatabase(new ZKDatabase(peer.getTxnFactory()));
peer.setLearnerType(config.getPeerType());
peer.setMyid(number);
}
示例3: readFrom
import org.apache.zookeeper.server.quorum.QuorumPeerConfig; //导入方法依赖的package包/类
/**
* Read attributes from a QuorumPeerConfig.
* @param config
*/
public void readFrom(QuorumPeerConfig config) {
clientPortAddress = config.getClientPortAddress();
dataDir = config.getDataDir();
dataLogDir = config.getDataLogDir();
tickTime = config.getTickTime();
maxClientCnxns = config.getMaxClientCnxns();
minSessionTimeout = config.getMinSessionTimeout();
maxSessionTimeout = config.getMaxSessionTimeout();
}
示例4: readFrom
import org.apache.zookeeper.server.quorum.QuorumPeerConfig; //导入方法依赖的package包/类
/**
* Read attributes from a QuorumPeerConfig.
* @param config
*/
public void readFrom(QuorumPeerConfig config) {
clientPortAddress = config.getClientPortAddress();
secureClientPortAddress = config.getSecureClientPortAddress();
dataDir = config.getDataDir();
dataLogDir = config.getDataLogDir();
tickTime = config.getTickTime();
maxClientCnxns = config.getMaxClientCnxns();
minSessionTimeout = config.getMinSessionTimeout();
maxSessionTimeout = config.getMaxSessionTimeout();
}