美文网首页
【Vesta发号器源码】PropertyMachineIdsPr

【Vesta发号器源码】PropertyMachineIdsPr

作者: DeanChangDM | 来源:发表于2019-05-13 14:12 被阅读0次

Vesta发号器源码解析——PropertyMachineIdsProvider

属性配置文件持有Id的模式,没啥东西,比单个的多了一个获取下一个的方法封装
实现上略有一点点区别

    private long[] machineIds;
    private int currentIndex;

    public long getNextMachineId() {
        return getMachineId();
    }

    public long getMachineId() {
        return machineIds[currentIndex++%machineIds.length];
    }

    public void setMachineIds(long[] machineIds) {
        this.machineIds = machineIds;
    }

相关文章

网友评论

      本文标题:【Vesta发号器源码】PropertyMachineIdsPr

      本文链接:https://www.haomeiwen.com/subject/lyblaqtx.html