KLALB UDP TEST

This commit is contained in:
Administrator
2024-01-30 16:54:09 +08:00
parent 722ab9710f
commit b4fccf3a03
67 changed files with 1977 additions and 929 deletions
@@ -11,14 +11,14 @@ public class ByteArrayRecycle {
this.capacity = capacity;
this.length = length;
}
public synchronized void recycle(byte[]b) {
public void recycle(byte[]b) {
if(b.length!=length)
throw new IllegalArgumentException("wrong length");
if(rec.size()<capacity) {
rec.add(b);
}
}
public synchronized byte[] create() {
public byte[] create() {
byte[]b=rec.poll();
if(b==null) {
b=new byte[length];