All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gateway.connector.utils.SeqUtils Maven / Gradle / Ivy

package com.gateway.connector.utils;

import java.util.concurrent.atomic.AtomicInteger;

public class SeqUtils {
	private static AtomicInteger seq = new AtomicInteger(0);

	public static int getCurrentSeq() {
		return seq.get();
	}

	public static int getSeq() {
		int s = seq.addAndGet(1);
		if (s == Integer.MAX_VALUE) {
			clear();
		}
		return s;
	}

	public static void set(int value) {
		seq.set(value);
	}

	public static void clear() {
		set(0);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy