Learner.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:URingPaxos 作者:
/**
 * Public constructor
 * 
 * @param id proposer id
 * @param config path to config file
 * @throws IOException 
 */
public Learner(int id,String config) throws IOException{
    this.ID = id;
    if(Configuration.getConfiguration().isEmpty()){
        Configuration.read(config);
    }
    NetworkInterface i = NetworkInterface.getByName(Configuration.getInterface());
    this.channel = DatagramChannel.open(StandardProtocolFamily.INET)
         .setOption(StandardSocketOptions.SO_REUSEADDR, true)
         .bind(Configuration.getGroup(PaxosRole.Learner))
         .setOption(StandardSocketOptions.IP_MULTICAST_IF, i);
    this.channel.configureBlocking(false);
    this.channel.join(Configuration.getGroup(PaxosRole.Learner).getAddress(), i);
    for(int n=0;n<threadCount;n++){
        executer.execute(new LearnerListener(this));
    }
    writer.execute(new LearnerWriter(this));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号