KLALB UDP TEST
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user