【Vesta发号器源码】PropertyMachineIdsPr

2019-05-13  本文已影响0人  DeanChangDM

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;
    }

上一篇 下一篇

猜你喜欢

热点阅读