Acceptor.java 文件源码

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

项目:URingPaxos 作者:
/**
 * Public constructor
 * 
 * @param id proposer id
 * @param config path to config file
 * @throws IOException 
 */
public Acceptor(int id,String config) throws IOException{
    this.ID = id;
    if(Configuration.getConfiguration().isEmpty()){
        Configuration.read(config);
    }

    NetworkInterface i = NetworkInterface.getByName(Configuration.getInterface());
    channel = DatagramChannel.open(StandardProtocolFamily.INET)
         .setOption(StandardSocketOptions.SO_REUSEADDR, true)
         .bind(Configuration.getGroup(PaxosRole.Acceptor))
         .setOption(StandardSocketOptions.IP_MULTICAST_IF, i);
    channel.configureBlocking(false);
    channel.join(Configuration.getGroup(PaxosRole.Acceptor).getAddress(), i);

    for(int n=0;n<threadCount;n++){
        executer.execute(new AcceptorListener(this));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号