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

io.polaris.core.guid.GuidSequenceClock Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
//package io.polaris.core.guid;
//
//
//import java.util.concurrent.atomic.AtomicLong;
//
///**
// * @author Qt
// * @since 1.8
// */
//public class GuidSequenceClock implements GuidClock {
//	private static final GuidSequenceClock DEFAULT = new GuidSequenceClock();
//	private AtomicLong currentTimestamp = new AtomicLong(System.currentTimeMillis());
//
//	public GuidSequenceClock() {
//		/*init(1000L);*/
//	}
//
//	public static GuidSequenceClock getInstance() {
//		return DEFAULT;
//	}
//
//	@Override
//	public long currentTimestamp() {
//		currentTimestamp.set(System.currentTimeMillis());
//		return currentTimestamp.get();
//	}
//
//	@Override
//	public long nextTimestamp(long lastTimestamp) {
//		long currTimestamp = lastTimestamp;
//		while (currTimestamp <= lastTimestamp) {
//			currTimestamp = currentTimestamp.incrementAndGet();
//		}
//		return currTimestamp;
//	}
//
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy