Skip to content

Commit

Permalink
gh-24 remove Pool on connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknow0 committed Nov 25, 2023
1 parent ec8b5d6 commit 6438fc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public final void free() throws InterruptedException, IOException {
pendingWrite.clear();
pendingRead.clear();
onFree();
pool.free(this);
// pool.free(this);
}

@SuppressWarnings("resource")
Expand Down
27 changes: 13 additions & 14 deletions unknow-server-util/src/main/java/unknow/server/util/io/Buffers.java
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,14 @@ private Chunk() {
* @return a chunk
*/
public static Chunk get() {
return new Chunk();
// synchronized (mutex) {
// if (idle == null)
// return new Chunk();
// Chunk c = idle;
// idle = idle.next;
// c.next = null;
// return c;
// }
synchronized (mutex) {
if (idle == null)
return new Chunk();
Chunk c = idle;
idle = idle.next;
c.next = null;
return c;
}
}

/**
Expand All @@ -603,11 +602,11 @@ public static Chunk get() {
*/
public static Chunk free(Chunk c) {
Chunk n = c.next;
// c.o = c.l = 0;
// synchronized (mutex) {
// c.next = idle;
// idle = c;
// }
c.o = c.l = 0;
synchronized (mutex) {
c.next = idle;
idle = c;
}
return n;
}
}
Expand Down

0 comments on commit 6438fc8

Please sign in to comment.