当前位置: 首页>>代码示例>>Java>>正文


Java QuorumMaj类代码示例

本文整理汇总了Java中org.apache.zookeeper.server.quorum.flexible.QuorumMaj的典型用法代码示例。如果您正苦于以下问题:Java QuorumMaj类的具体用法?Java QuorumMaj怎么用?Java QuorumMaj使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QuorumMaj类属于org.apache.zookeeper.server.quorum.flexible包,在下文中一共展示了QuorumMaj类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: QuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
        File dataLogDir, int electionType,
        long myid, int tickTime, int initLimit, int syncLimit,
        boolean quorumListenOnAllIPs,
        ServerCnxnFactory cnxnFactory, 
        QuorumVerifier quorumConfig) throws IOException {
    this();
    this.cnxnFactory = cnxnFactory;
    this.quorumPeers = quorumPeers;
    this.electionType = electionType;
    this.myid = myid;
    this.tickTime = tickTime;
    this.initLimit = initLimit;
    this.syncLimit = syncLimit;        
    this.quorumListenOnAllIPs = quorumListenOnAllIPs;
    this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
    this.zkDb = new ZKDatabase(this.logFactory);
    if(quorumConfig == null)
        this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
    else this.quorumConfig = quorumConfig;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:22,代码来源:QuorumPeer.java

示例2: createQuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
private QuorumPeer createQuorumPeer(File tmpDir) throws IOException,
        FileNotFoundException {
    QuorumPeer peer = new QuorumPeer();
    peer.syncLimit = SYNC_LIMIT;
    peer.initLimit = 2;
    peer.tickTime = 2000;
    peer.quorumPeers = new HashMap<Long, QuorumServer>();
    peer.quorumPeers.put(1L, new QuorumServer(0, "0.0.0.0", 33221, 0, null));
    peer.quorumPeers.put(1L, new QuorumServer(1, "0.0.0.0", 33223, 0, null));
    peer.setQuorumVerifier(new QuorumMaj(3));
    peer.setCnxnFactory(new NullServerCnxnFactory());
    File version2 = new File(tmpDir, "version-2");
    version2.mkdir();
    FileOutputStream fos;
    fos = new FileOutputStream(new File(version2, "currentEpoch"));
    fos.write("0\n".getBytes());
    fos.close();
    fos = new FileOutputStream(new File(version2, "acceptedEpoch"));
    fos.write("0\n".getBytes());
    fos.close();
    return peer;
}
 
开发者ID:jdc91,项目名称:StreamProcessingInfrastructure,代码行数:23,代码来源:Zab1_0Test.java

示例3: QuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
        File dataLogDir, int electionType,
        long myid, int tickTime, int initLimit, int syncLimit,
        ServerCnxnFactory cnxnFactory, 
        QuorumVerifier quorumConfig) throws IOException {
    this();
    this.cnxnFactory = cnxnFactory;
    this.quorumPeers = quorumPeers;
    this.electionType = electionType;
    this.myid = myid;
    this.tickTime = tickTime;
    this.initLimit = initLimit;
    this.syncLimit = syncLimit;        
    this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
    this.zkDb = new ZKDatabase(this.logFactory);
    if(quorumConfig == null)
        this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
    else this.quorumConfig = quorumConfig;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:20,代码来源:QuorumPeer.java

示例4: createQuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
private QuorumPeer createQuorumPeer(File tmpDir) throws IOException,
        FileNotFoundException {
    QuorumPeer peer = new QuorumPeer();
    peer.syncLimit = 2;
    peer.initLimit = 2;
    peer.tickTime = 2000;
    peer.quorumPeers = new HashMap<Long, QuorumServer>();
    peer.quorumPeers.put(1L, new QuorumServer(0, new InetSocketAddress(33221)));
    peer.quorumPeers.put(1L, new QuorumServer(1, new InetSocketAddress(33223)));
    peer.setQuorumVerifier(new QuorumMaj(3));
    peer.setCnxnFactory(new NullServerCnxnFactory());
    File version2 = new File(tmpDir, "version-2");
    version2.mkdir();
    new FileOutputStream(new File(version2, "currentEpoch")).write("0\n".getBytes());
    new FileOutputStream(new File(version2, "acceptedEpoch")).write("0\n".getBytes());
    return peer;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:18,代码来源:Zab1_0Test.java

示例5: createQuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
private QuorumPeer createQuorumPeer(File tmpDir) throws IOException,
        FileNotFoundException {
    QuorumPeer peer = new QuorumPeer();
    peer.syncLimit = SYNC_LIMIT;
    peer.initLimit = 2;
    peer.tickTime = 2000;
    peer.quorumPeers = new HashMap<Long, QuorumServer>();
    peer.quorumPeers.put(1L, new QuorumServer(0, new InetSocketAddress(33221)));
    peer.quorumPeers.put(1L, new QuorumServer(1, new InetSocketAddress(33223)));
    peer.setQuorumVerifier(new QuorumMaj(3));
    peer.setCnxnFactory(new NullServerCnxnFactory());
    File version2 = new File(tmpDir, "version-2");
    version2.mkdir();
    FileOutputStream fos;
    fos = new FileOutputStream(new File(version2, "currentEpoch"));
    fos.write("0\n".getBytes());
    fos.close();
    fos = new FileOutputStream(new File(version2, "acceptedEpoch"));
    fos.write("0\n".getBytes());
    fos.close();
    return peer;
}
 
开发者ID:wangyangjun,项目名称:StreamBench,代码行数:23,代码来源:Zab1_0Test.java

示例6: processConfigData

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
private void processConfigData(byte[] data) throws Exception
{
    Properties properties = new Properties();
    properties.load(new ByteArrayInputStream(data));
    log.info("New config event received: {}", properties);

    if (!properties.isEmpty())
    {
        QuorumMaj newConfig = new QuorumMaj(properties);
        String connectionString = configToConnectionString(newConfig);
        if (connectionString.trim().length() > 0)
        {
            currentConfig.set(newConfig);
            ensembleProvider.setConnectionString(connectionString);
        }
        else
        {
            log.error("Invalid config event received: {}", properties);
        }
    }
    else
    {
        log.debug("Ignoring new config as it is empty");
    }
}
 
开发者ID:apache,项目名称:curator,代码行数:26,代码来源:EnsembleTracker.java

示例7: QuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
        File dataLogDir, int electionType,
        long myid, int tickTime, int initLimit, int syncLimit,
        NIOServerCnxn.Factory cnxnFactory, 
        QuorumVerifier quorumConfig) throws IOException {
    this();
    this.cnxnFactory = cnxnFactory;
    this.quorumPeers = quorumPeers;
    this.electionType = electionType;
    this.myid = myid;
    this.tickTime = tickTime;
    this.initLimit = initLimit;
    this.syncLimit = syncLimit;        
    this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
    this.zkDb = new ZKDatabase(this.logFactory);
    if(quorumConfig == null)
        this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
    else this.quorumConfig = quorumConfig;
}
 
开发者ID:prodigeni,项目名称:zookeeper.dsc,代码行数:20,代码来源:QuorumPeer.java

示例8: MockQuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
public MockQuorumPeer(Map<Long,QuorumServer> quorumPeers, File snapDir,
        File logDir, int clientPort, int electionAlg,
        long myid, int tickTime, int initLimit, int syncLimit)
throws IOException
{
    super(quorumPeers, snapDir, logDir, electionAlg,
            myid,tickTime, initLimit,syncLimit, false,
            ServerCnxnFactory.createFactory(clientPort, -1),
            new QuorumMaj(countParticipants(quorumPeers)));
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:11,代码来源:LENonTerminateTest.java

示例9: QuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
/**
 * For backward compatibility purposes, we instantiate QuorumMaj by default.
 */

public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
        File dataLogDir, int electionType,
        long myid, int tickTime, int initLimit, int syncLimit,
        ServerCnxnFactory cnxnFactory) throws IOException {
    this(quorumPeers, dataDir, dataLogDir, electionType, myid, tickTime,
            initLimit, syncLimit, false, cnxnFactory,
            new QuorumMaj(quorumPeers));
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:13,代码来源:QuorumPeer.java

示例10: createQuorumVerifier

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
private static QuorumVerifier createQuorumVerifier(Properties dynamicConfigProp, boolean isHierarchical) throws ConfigException{
   if(isHierarchical){
        return new QuorumHierarchical(dynamicConfigProp);
    } else {
       /*
         * The default QuorumVerifier is QuorumMaj
         */        
        //LOG.info("Defaulting to majority quorums");
        return new QuorumMaj(dynamicConfigProp);            
    }          
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:12,代码来源:QuorumPeerConfig.java

示例11: MockQuorumPeer

import org.apache.zookeeper.server.quorum.flexible.QuorumMaj; //导入依赖的package包/类
public MockQuorumPeer(Map<Long,QuorumServer> quorumPeers, File snapDir,
        File logDir, int clientPort, int electionAlg,
        long myid, int tickTime, int initLimit, int syncLimit)
throws IOException
{
    super(quorumPeers, snapDir, logDir, electionAlg,
            myid,tickTime, initLimit,syncLimit,
            ServerCnxnFactory.createFactory(clientPort, -1),
            new QuorumMaj(countParticipants(quorumPeers)));
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:11,代码来源:LENonTerminateTest.java


注:本文中的org.apache.zookeeper.server.quorum.flexible.QuorumMaj类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。