重发数据包优先

This commit is contained in:
Administrator
2023-01-05 08:19:54 +08:00
parent 62b22410a3
commit ea97e3891f
11 changed files with 428 additions and 42 deletions
+31
View File
@@ -0,0 +1,31 @@
package org.kne.io;
public abstract class Task implements Runnable{
private volatile boolean begin=false,end=false;
private volatile Object t=new Object();
@Override
public void run() {
begin=true;
runTask();
end=true;
if(t!=null) {
synchronized(t) {
t.notifyAll();
}
}
}
public void waitfortask() {
synchronized(t){
try {
while(!end) {
t.wait(1);
}
} catch (InterruptedException e) {
e.printStackTrace();
}}
}
protected abstract void runTask();
}