// Path: ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/exception/GetSequenceTimeoutException.java
// public class GetSequenceTimeoutException extends SequenceException {
// 
//     public GetSequenceTimeoutException() {
//     }
// 
//     public GetSequenceTimeoutException(String message) {
//         super(message);
//     }
// 
//     public GetSequenceTimeoutException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public GetSequenceTimeoutException(Throwable cause) {
//         super(cause);
//     }
// 
//     public GetSequenceTimeoutException(String message, Throwable cause, boolean enableSuppression,
//                                        boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/exception/SequenceException.java
// public class SequenceException extends RuntimeException {
// 
//     public SequenceException() {
//     }
// 
//     public SequenceException(String message) {
//         super(message);
//     }
// 
//     public SequenceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public SequenceException(Throwable cause) {
//         super(cause);
//     }
// 
//     public SequenceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


import org.hellojavaer.ddal.sequence.exception.GetSequenceTimeoutException;
import org.hellojavaer.ddal.sequence.exception.SequenceException;
import java.util.Collection;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
        }
    }

    public PollingGroupSequence(Collection<? extends Sequence> sequences) {
        if (sequences == null || sequences.isEmpty()) {
            throw new IllegalArgumentException("sequences can't be empty");
        }
        this.cycleList = new LinkedCycleList(sequences);
    }

    public PollingGroupSequence(Sequence... sequences) {
        if (sequences == null || sequences.length == 0) {
            throw new IllegalArgumentException("sequences can't be empty");
        }
        this.cycleList = new LinkedCycleList(sequences);
    }

    @Override
    public long nextValue(long timeout, final TimeUnit timeUnit) throws GetSequenceTimeoutException {
        long now = System.nanoTime();
        cycleList.next();
        for (Sequence sequence : cycleList) {
            try {
                return sequence.nextValue(0, TimeUnit.NANOSECONDS);
            } catch (GetSequenceTimeoutException e) {
                continue;
            }
        }
        try {
            if (lock.tryLock(timeout, timeUnit) == false) {
// Path: ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/exception/GetSequenceTimeoutException.java
// public class GetSequenceTimeoutException extends SequenceException {
// 
//     public GetSequenceTimeoutException() {
//     }
// 
//     public GetSequenceTimeoutException(String message) {
//         super(message);
//     }
// 
//     public GetSequenceTimeoutException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public GetSequenceTimeoutException(Throwable cause) {
//         super(cause);
//     }
// 
//     public GetSequenceTimeoutException(String message, Throwable cause, boolean enableSuppression,
//                                        boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }
// 
// Path: ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/exception/SequenceException.java
// public class SequenceException extends RuntimeException {
// 
//     public SequenceException() {
//     }
// 
//     public SequenceException(String message) {
//         super(message);
//     }
// 
//     public SequenceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public SequenceException(Throwable cause) {
//         super(cause);
//     }
// 
//     public SequenceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
//         super(message, cause, enableSuppression, writableStackTrace);
//     }
// }


// Path: ddal-sequence/src/main/java/org/hellojavaer/ddal/sequence/PollingGroupSequence.java
import org.hellojavaer.ddal.sequence.exception.GetSequenceTimeoutException;
import org.hellojavaer.ddal.sequence.exception.SequenceException;
import java.util.Collection;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;

        }
    }

    public PollingGroupSequence(Collection<? extends Sequence> sequences) {
        if (sequences == null || sequences.isEmpty()) {
            throw new IllegalArgumentException("sequences can't be empty");
        }
        this.cycleList = new LinkedCycleList(sequences);
    }

    public PollingGroupSequence(Sequence... sequences) {
        if (sequences == null || sequences.length == 0) {
            throw new IllegalArgumentException("sequences can't be empty");
        }
        this.cycleList = new LinkedCycleList(sequences);
    }

    @Override
    public long nextValue(long timeout, final TimeUnit timeUnit) throws GetSequenceTimeoutException {
        long now = System.nanoTime();
        cycleList.next();
        for (Sequence sequence : cycleList) {
            try {
                return sequence.nextValue(0, TimeUnit.NANOSECONDS);
            } catch (GetSequenceTimeoutException e) {
                continue;
            }
        }
        try {
            if (lock.tryLock(timeout, timeUnit) == false) {
                throw new GetSequenceTimeoutException(timeout + " " + timeUnit);