/** * Synchronous 'next' * @param id sequencer id * @param wrapAt wrap at value * @return next sequencer value */ public long next (String id, long wrapAt) { return getOrCreate(id).next(wrapAt); }
/** * Asynchronous 'next' * * @param id sequencer ID * @param lockedBy unique client identifier (any long, has to be system-wide unique) * @param lockTimeout once lock is obtained, keep it fo 'lockTimeout' millis (if not 'released' earlier) * @param timeout time (in millis) to wait for this lock * @param wrapAt wrap at value * @return next sequencer value * @throws LockTimeoutException if lock can't be obtained after 'timeout' has elapsed */ public long next (String id, long lockedBy, long lockTimeout, long timeout, long wrapAt) { return lock (id, lockedBy, lockTimeout, timeout, seq -> seq.next(wrapAt)); }