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

com.github.javaclub.mq.common.util.UUID Maven / Gradle / Ivy

The newest version!
package com.github.javaclub.mq.common.util;

import java.util.concurrent.atomic.AtomicInteger;

public class UUID {
	
	public static AtomicInteger packetId = new AtomicInteger(1);
	
	public static int getPacketId() {
		if(packetId.get() > Integer.MAX_VALUE - 1000L) {
			packetId.set(1);
		}
		
		return packetId.getAndIncrement();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy