protobuf
This commit is contained in:
@@ -130,14 +130,13 @@ public class ProtobufWriter extends Writer implements ByteTuple {
|
|||||||
protected boolean recycle() {
|
protected boolean recycle() {
|
||||||
super.recycle();
|
super.recycle();
|
||||||
if (this.delegate != null && this.pool != null) {
|
if (this.delegate != null && this.pool != null) {
|
||||||
List<ProtobufWriter> list = new ArrayList<>();
|
ProtobufWriter s;
|
||||||
ProtobufWriter next = this;
|
ProtobufWriter p = this.delegate;
|
||||||
while ((next = next.child) != null) {
|
do {
|
||||||
list.add(next);
|
s = p;
|
||||||
}
|
p = p.parent;
|
||||||
for (ProtobufWriter item : list) {
|
offerPool(s);
|
||||||
offerPool(item);
|
} while (p != this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.child = null;
|
this.child = null;
|
||||||
@@ -169,7 +168,7 @@ public class ProtobufWriter extends Writer implements ByteTuple {
|
|||||||
}
|
}
|
||||||
ProtobufWriter result = queue.poll();
|
ProtobufWriter result = queue.poll();
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = new ProtobufWriter();
|
result = new ProtobufWriter(new byte[256], 0);
|
||||||
}
|
}
|
||||||
if (delegate == null) {
|
if (delegate == null) {
|
||||||
result.parent = this;
|
result.parent = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user