Java 类org.apache.zookeeper.server.FinalRequestProcessor 实例源码

项目:https-github.com-apache-zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(finalProcessor, getLeader());
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    prepRequestProcessor = new PrepRequestProcessor(this, proposalProcessor);
    prepRequestProcessor.start();
    firstProcessor = new LeaderRequestProcessor(this, prepRequestProcessor);

    setupContainerManager();
}
项目:https-github.com-apache-zookeeper    文件:RaceConditionTest.java   
@Override
protected Leader makeLeader(FileTxnSnapLog logFactory) throws IOException {
    LeaderZooKeeperServer zk = new LeaderZooKeeperServer(logFactory, this, this.getZkDb()) {
        @Override
        protected void setupRequestProcessors() {
            /**
             * This method is overridden to make a place to inject
             * MockSyncRequestProcessor
             */
            RequestProcessor finalProcessor = new FinalRequestProcessor(this);
            RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(finalProcessor,
                    getLeader());
            commitProcessor = new CommitProcessor(toBeAppliedProcessor, Long.toString(getServerId()), false,
                    getZooKeeperServerListener());
            commitProcessor.start();
            ProposalRequestProcessor proposalProcessor = new MockProposalRequestProcessor(this,
                    commitProcessor);
            proposalProcessor.initialize();
            prepRequestProcessor = new PrepRequestProcessor(this, proposalProcessor);
            prepRequestProcessor.start();
            firstProcessor = new LeaderRequestProcessor(this, prepRequestProcessor);
        }

    };
    return new Leader(this, zk);
}
项目:https-github.com-apache-zookeeper    文件:CommitProcessorTest.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(zks);
    // ValidateProcessor is set up in a similar fashion to ToBeApplied
    // processor, so it can do pre/post validating of requests
    ValidateProcessor validateProcessor =
        new ValidateProcessor(finalProcessor);
    commitProcessor = new CommitProcessor(validateProcessor, "1", true, null);
    validateProcessor.setCommitProcessor(commitProcessor);
    commitProcessor.start();
    MockProposalRequestProcessor proposalProcessor =
        new MockProposalRequestProcessor(commitProcessor);
    proposalProcessor.start();
    firstProcessor = new PrepRequestProcessor(zks, proposalProcessor);
    getFirstProcessor().start();
}
项目:bigstreams    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:bigstreams    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:zookeeper-src-learning    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:SecureKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(finalProcessor, getLeader());
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    prepRequestProcessor = new PrepRequestProcessor(this, proposalProcessor);
    prepRequestProcessor.start();
    firstProcessor = new LeaderRequestProcessor(this, prepRequestProcessor);

    setupContainerManager();
}
项目:SecureKeeper    文件:CommitProcessorTest.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(zks);
    // ValidateProcessor is set up in a similar fashion to ToBeApplied
    // processor, so it can do pre/post validating of requests
    ValidateProcessor validateProcessor =
        new ValidateProcessor(finalProcessor);
    commitProcessor = new CommitProcessor(validateProcessor, "1", true,
            getZooKeeperServerListener());
    validateProcessor.setCommitProcessor(commitProcessor);
    commitProcessor.start();
    MockProposalRequestProcessor proposalProcessor =
        new MockProposalRequestProcessor(commitProcessor);
    proposalProcessor.start();
    firstProcessor = new PrepRequestProcessor(zks, proposalProcessor);
    firstProcessor.start();
}
项目:SecureKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(finalProcessor, getLeader());
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    prepRequestProcessor = new PrepRequestProcessor(this, proposalProcessor);
    prepRequestProcessor.start();
    firstProcessor = new LeaderRequestProcessor(this, prepRequestProcessor);

    setupContainerManager();
}
项目:SecureKeeper    文件:CommitProcessorTest.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(zks);
    // ValidateProcessor is set up in a similar fashion to ToBeApplied
    // processor, so it can do pre/post validating of requests
    ValidateProcessor validateProcessor =
        new ValidateProcessor(finalProcessor);
    commitProcessor = new CommitProcessor(validateProcessor, "1", true,
            getZooKeeperServerListener());
    validateProcessor.setCommitProcessor(commitProcessor);
    commitProcessor.start();
    MockProposalRequestProcessor proposalProcessor =
        new MockProposalRequestProcessor(commitProcessor);
    proposalProcessor.start();
    firstProcessor = new PrepRequestProcessor(zks, proposalProcessor);
    firstProcessor.start();
}
项目:StreamBench    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();

    /*
     * Observer should write to disk, so that the it won't request
     * too old txn from the leader which may lead to getting an entire
     * snapshot.
     *
     * However, this may degrade performance as it has to write to disk
     * and do periodic snapshot which may double the memory requirements
     */
    if (syncRequestProcessorEnabled) {
        syncProcessor = new SyncRequestProcessor(this, null);
        syncProcessor.start();
    }
}
项目:ACaZoo    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:LoadBalanced_zk    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:LoadBalanced_zk    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:zookeeper.dsc    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:zookeeper-pkg    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor(getObserver()));
    syncProcessor.start();
}
项目:fuck_zookeeper    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 * 
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next,
        ConcurrentLinkedQueue<Proposal> toBeApplied) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.toBeApplied = toBeApplied;
    this.next = next;
}
项目:fuck_zookeeper    文件:FollowerZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
    ((FollowerRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor((Learner)getFollower()));
    syncProcessor.start();
}
项目:fuck_zookeeper    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();

    /*
     * Observer should write to disk, so that the it won't request
     * too old txn from the leader which may lead to getting an entire
     * snapshot.
     *
     * However, this may degrade performance as it has to write to disk
     * and do periodic snapshot which may double the memory requirements
     */
    if (syncRequestProcessorEnabled) {
        syncProcessor = new SyncRequestProcessor(this, null);
        syncProcessor.start();
    }
}
项目:fuck_zookeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(
            finalProcessor, getLeader().toBeApplied);
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    firstProcessor = new PrepRequestProcessor(this, proposalProcessor);
    ((PrepRequestProcessor)firstProcessor).start();
}
项目:fuck_zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor prepProcessor = new PrepRequestProcessor(this, finalProcessor);
    ((PrepRequestProcessor) prepProcessor).start();
    firstProcessor = new ReadOnlyRequestProcessor(this, prepProcessor);
    ((ReadOnlyRequestProcessor) firstProcessor).start();
}
项目:https-github.com-apache-zookeeper    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 *
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next, Leader leader) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.leader = leader;
    this.next = next;
}
项目:https-github.com-apache-zookeeper    文件:FollowerZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true, getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
    ((FollowerRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor((Learner)getFollower()));
    syncProcessor.start();
}
项目:https-github.com-apache-zookeeper    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();

    /*
     * Observer should write to disk, so that the it won't request
     * too old txn from the leader which may lead to getting an entire
     * snapshot.
     *
     * However, this may degrade performance as it has to write to disk
     * and do periodic snapshot which may double the memory requirements
     */
    if (syncRequestProcessorEnabled) {
        syncProcessor = new SyncRequestProcessor(this, null);
        syncProcessor.start();
    }
}
项目:https-github.com-apache-zookeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor prepProcessor = new PrepRequestProcessor(this, finalProcessor);
    ((PrepRequestProcessor) prepProcessor).start();
    firstProcessor = new ReadOnlyRequestProcessor(this, prepProcessor);
    ((ReadOnlyRequestProcessor) firstProcessor).start();
}
项目:ZooKeeper    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 * 
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next,
        ConcurrentLinkedQueue<Proposal> toBeApplied) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.toBeApplied = toBeApplied;
    this.next = next;
}
项目:ZooKeeper    文件:FollowerZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
    ((FollowerRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor((Learner)getFollower()));
    syncProcessor.start();
}
项目:ZooKeeper    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();

    /*
     * Observer should write to disk, so that the it won't request
     * too old txn from the leader which may lead to getting an entire
     * snapshot.
     *
     * However, this may degrade performance as it has to write to disk
     * and do periodic snapshot which may double the memory requirements
     */
    if (syncRequestProcessorEnabled) {
        syncProcessor = new SyncRequestProcessor(this, null);
        syncProcessor.start();
    }
}
项目:ZooKeeper    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(
            finalProcessor, getLeader().toBeApplied);
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    firstProcessor = new PrepRequestProcessor(this, proposalProcessor);
    ((PrepRequestProcessor)firstProcessor).start();
}
项目:ZooKeeper    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor prepProcessor = new PrepRequestProcessor(this, finalProcessor);
    ((PrepRequestProcessor) prepProcessor).start();
    firstProcessor = new ReadOnlyRequestProcessor(this, prepProcessor);
    ((ReadOnlyRequestProcessor) firstProcessor).start();
}
项目:StreamProcessingInfrastructure    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 * 
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next,
        ConcurrentLinkedQueue<Proposal> toBeApplied) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.toBeApplied = toBeApplied;
    this.next = next;
}
项目:StreamProcessingInfrastructure    文件:FollowerZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
    ((FollowerRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor((Learner)getFollower()));
    syncProcessor.start();
}
项目:StreamProcessingInfrastructure    文件:ObserverZooKeeperServer.java   
/**
 * Set up the request processors for an Observer:
 * firstProcesor->commitProcessor->finalProcessor
 */
@Override
protected void setupRequestProcessors() {      
    // We might consider changing the processor behaviour of 
    // Observers to, for example, remove the disk sync requirements.
    // Currently, they behave almost exactly the same as followers.
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true,
            getZooKeeperServerListener());
    commitProcessor.start();
    firstProcessor = new ObserverRequestProcessor(this, commitProcessor);
    ((ObserverRequestProcessor) firstProcessor).start();

    /*
     * Observer should write to disk, so that the it won't request
     * too old txn from the leader which may lead to getting an entire
     * snapshot.
     *
     * However, this may degrade performance as it has to write to disk
     * and do periodic snapshot which may double the memory requirements
     */
    if (syncRequestProcessorEnabled) {
        syncProcessor = new SyncRequestProcessor(this, null);
        syncProcessor.start();
    }
}
项目:StreamProcessingInfrastructure    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(
            finalProcessor, getLeader().toBeApplied);
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false,
            getZooKeeperServerListener());
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    firstProcessor = new PrepRequestProcessor(this, proposalProcessor);
    ((PrepRequestProcessor)firstProcessor).start();
}
项目:StreamProcessingInfrastructure    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor prepProcessor = new PrepRequestProcessor(this, finalProcessor);
    ((PrepRequestProcessor) prepProcessor).start();
    firstProcessor = new ReadOnlyRequestProcessor(this, prepProcessor);
    ((ReadOnlyRequestProcessor) firstProcessor).start();
}
项目:bigstreams    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 * 
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next,
        ConcurrentLinkedQueue<Proposal> toBeApplied) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.toBeApplied = toBeApplied;
    this.next = next;
}
项目:bigstreams    文件:FollowerZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    commitProcessor = new CommitProcessor(finalProcessor,
            Long.toString(getServerId()), true);
    commitProcessor.start();
    firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
    ((FollowerRequestProcessor) firstProcessor).start();
    syncProcessor = new SyncRequestProcessor(this,
            new SendAckRequestProcessor((Learner)getFollower()));
    syncProcessor.start();
}
项目:bigstreams    文件:LeaderZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(
            finalProcessor, getLeader().toBeApplied);
    commitProcessor = new CommitProcessor(toBeAppliedProcessor,
            Long.toString(getServerId()), false);
    commitProcessor.start();
    ProposalRequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
            commitProcessor);
    proposalProcessor.initialize();
    firstProcessor = new PrepRequestProcessor(this, proposalProcessor);
    ((PrepRequestProcessor)firstProcessor).start();
}
项目:bigstreams    文件:ReadOnlyZooKeeperServer.java   
@Override
protected void setupRequestProcessors() {
    RequestProcessor finalProcessor = new FinalRequestProcessor(this);
    RequestProcessor prepProcessor = new PrepRequestProcessor(this, finalProcessor);
    ((PrepRequestProcessor) prepProcessor).start();
    firstProcessor = new ReadOnlyRequestProcessor(this, prepProcessor);
    ((ReadOnlyRequestProcessor) firstProcessor).start();
}
项目:bigstreams    文件:Leader.java   
/**
 * This request processor simply maintains the toBeApplied list. For
 * this to work next must be a FinalRequestProcessor and
 * FinalRequestProcessor.processRequest MUST process the request
 * synchronously!
 * 
 * @param next
 *                a reference to the FinalRequestProcessor
 */
ToBeAppliedRequestProcessor(RequestProcessor next,
        ConcurrentLinkedQueue<Proposal> toBeApplied) {
    if (!(next instanceof FinalRequestProcessor)) {
        throw new RuntimeException(ToBeAppliedRequestProcessor.class
                .getName()
                + " must be connected to "
                + FinalRequestProcessor.class.getName()
                + " not "
                + next.getClass().getName());
    }
    this.toBeApplied = toBeApplied;
    this.next = next;
}