wsky / top-push

Message-push abstraction component, provide useful messaging components.
8 stars 4 forks source link

make sender balancing smater #44

Open wsky opened 10 years ago

wsky commented 10 years ago

24

    protected int calculate(int pending) {
        if (!this.balancing)
            return this.maxFlushCount;
        //TODO make it smarter
        int flushCount = this.highwater / pending;
        if (flushCount > this.maxFlushCount)
            flushCount = this.maxFlushCount;
        if (flushCount < this.minFlushCount)
            flushCount = this.minFlushCount;
        return flushCount;
    }
wsky commented 10 years ago