隧道链接改成标准URI格式

This commit is contained in:
2026-07-11 22:28:50 +08:00
parent 053450429c
commit 314f90b5f3
66 changed files with 1578 additions and 1506 deletions
@@ -1,21 +1,13 @@
package org.kne.concurrent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.LockSupport;
import java.util.function.Consumer;
import org.jctools.queues.MpscArrayQueue;
import org.kne.cloud.network.klalb.PerformanceStrategy;
public class HighPerformanceExecutor2 implements Executor {
@@ -33,6 +25,8 @@ public class HighPerformanceExecutor2 implements Executor {
threads[i]=t;
}
}
private static class ThreadElement implements Runnable{
private MpscArrayQueue<Runnable> queue=new MpscArrayQueue<Runnable>(2048);
private AtomicInteger size=new AtomicInteger();
@@ -80,7 +74,7 @@ public class HighPerformanceExecutor2 implements Executor {
}
@Override
public void execute(Runnable command) {
if(execute0((x)->{command.run();},1000)) {
if(execute0((x)->{command.run();},1000, PerformanceStrategy.MULTI_FILL)) {
return;
}
System.out.println("loss!");
@@ -89,42 +83,47 @@ public class HighPerformanceExecutor2 implements Executor {
}
/*private long vl=0;
private boolean execute0(Consumer<Boolean> command,int limit) {
long ord=vl++;
private long vl=0;
private boolean execute0(Consumer<Boolean> command, int limit, PerformanceStrategy strategy) {
if(strategy.equals(PerformanceStrategy.MULTI_SCATTER)){
long ord=vl++;
ThreadElement te= threads[(int) (ord%threads.length)];
boolean b=te.size()>limit;
return te.putTask( ()->{command.accept(b);});
}*/
private boolean execute0(Consumer<Boolean> command,int limit) {
for(int i=0;i<threads.length;i++) {
ThreadElement te= threads[i];
boolean b=te.size()>limit;
if(!b) {
if(te.putTask( ()->{command.accept(false);})){
return true;
}else {
for (int i = 0; i < threads.length; i++) {
ThreadElement te = threads[i];
boolean b = te.size() > limit;
if (!b) {
if (te.putTask(() -> {
command.accept(false);
})) {
return true;
}
}
}
for (int i = 0; i < threads.length; i++) {
ThreadElement te = threads[i];
if (te.putTask(() -> {
command.accept(true);
})) {
return true;
}
}
return false;
}
for(int i=0;i<threads.length;i++) {
ThreadElement te= threads[i];
if(te.putTask( ()->{command.accept(true);})){
return true;
}
}
return false;
}
public void executeWithCongestionReport(Consumer<Boolean> command) {
if(execute0(command,1000)) {
if(execute0(command,1000, PerformanceStrategy.MULTI_FILL)) {
return;
}
System.out.println("loss!");
}
public void executeWithCongestionReport(Consumer<Boolean> command,int limit) {
if(execute0(command,limit)) {
public void executeWithCongestionReport(Consumer<Boolean> command, int limit, PerformanceStrategy strategy) {
if(execute0(command,limit,strategy)) {
return;
}
System.out.println("loss!");