KLALB 3.6.0开发一半的状态

This commit is contained in:
2026-07-06 17:03:27 +08:00
parent 620afef715
commit c8b183da71
90 changed files with 1963 additions and 3757 deletions
+14 -11
View File
@@ -10,10 +10,11 @@ import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jctools.counters.CountersFactory;
import org.jctools.counters.FixedSizeStripedLongCounter;
import org.kne.cloud.network.MultipurposeSocketAddress;
import org.kne.cloud.network.ipv6.IPv6Address;
@@ -385,20 +386,17 @@ public static String parseAbbrIPv6(String IPv6Str) {
private final long id;
private long counter=0;
private UUID randUUID=UUID.randomUUID();
private long time=System.nanoTime();
private static final long INTERVAL=1000000L;
private long randUUIDh;
private long randUUIDl;
private static SecureRandom sr=new SecureRandom();
public UUIDGenarator(long threadId) {
this.id=threadId;
randUUIDh=sr.nextLong();
randUUIDl=sr.nextLong();
}
public UUID genarateUUID() {
long curr=System.nanoTime();
if(curr-time>INTERVAL) {
time=curr;
randUUID=UUID.randomUUID();
}
long h=randUUID.getMostSignificantBits()^id;
long l=randUUID.getLeastSignificantBits()^counter;
long h=randUUIDh^id;
long l=randUUIDl^counter;
UUID ret=new UUID(h, l);
counter++;
@@ -413,4 +411,9 @@ public static String parseAbbrIPv6(String IPv6Str) {
//return UUID.randomUUID();
return gens.get().genarateUUID();
}
public static FixedSizeStripedLongCounter createCounter() {
return CountersFactory.createFixedSizeStripedCounter(Runtime.getRuntime().availableProcessors());
}
}