Package fi.jumi.core.runs

Source Code of fi.jumi.core.runs.RunIdSequence

// Copyright © 2011-2013, Esko Luontola <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.core.runs;

import fi.jumi.core.api.RunId;

import javax.annotation.concurrent.ThreadSafe;
import java.util.concurrent.atomic.AtomicInteger;

@ThreadSafe
public class RunIdSequence {

    private final AtomicInteger nextId = new AtomicInteger(RunId.FIRST_ID);

    public RunId nextRunId() {
        int currentId = nextId.getAndIncrement();
        return new RunId(currentId);
    }
}
TOP

Related Classes of fi.jumi.core.runs.RunIdSequence

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.