diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-07-22 22:52:49 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-07-22 22:52:49 -0700 |
| commit | 6839f96c0cd417a2f05d5ce999030c5e314dce84 (patch) | |
| tree | b55be7609d73820b664afcf04df58d0f95774f4a | |
| parent | 943fa4ea0c053c7964c8148863122c6d98372516 (diff) | |
| download | seaweedfs-6839f96c0cd417a2f05d5ce999030c5e314dce84.tar.xz seaweedfs-6839f96c0cd417a2f05d5ce999030c5e314dce84.zip | |
simplify
3 files changed, 2 insertions, 2 deletions
diff --git a/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java b/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java index 55f003a18..994bcaa2b 100644 --- a/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java +++ b/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java @@ -18,6 +18,7 @@ public class ByteBufferPool { if (bufferSize < MIN_BUFFER_SIZE) { bufferSize = MIN_BUFFER_SIZE; } + LOG.debug("requested new buffer {}", bufferSize); if (bufferList.isEmpty()) { return ByteBuffer.allocate(bufferSize); } @@ -33,6 +34,7 @@ public class ByteBufferPool { } public static synchronized void release(ByteBuffer obj) { + obj.clear(); bufferList.add(0, obj); } diff --git a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedOutputStream.java b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedOutputStream.java index d62d74fb1..1a638677f 100644 --- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedOutputStream.java +++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedOutputStream.java @@ -187,7 +187,6 @@ public class SeaweedOutputStream extends OutputStream { // System.out.println(path + " is going to save [" + (writePosition) + "," + ((writePosition) + bytesLength) + ")"); SeaweedWrite.writeData(entry, replication, filerGrpcClient, writePosition, bufferToWrite.array(), bufferToWrite.position(), bufferToWrite.limit()); // System.out.println(path + " saved [" + (writePosition) + "," + ((writePosition) + bytesLength) + ")"); - bufferToWrite.clear(); ByteBufferPool.release(bufferToWrite); return null; }); diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedOutputStream.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedOutputStream.java index 05805b9e5..37068c73a 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedOutputStream.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedOutputStream.java @@ -234,7 +234,6 @@ public class SeaweedOutputStream extends OutputStream implements Syncable, Strea // System.out.println(path + " is going to save [" + (writePosition) + "," + ((writePosition) + bytesLength) + ")"); SeaweedWrite.writeData(entry, replication, filerGrpcClient, writePosition, bufferToWrite.array(), bufferToWrite.position(), bufferToWrite.limit()); // System.out.println(path + " saved [" + (writePosition) + "," + ((writePosition) + bytesLength) + ")"); - bufferToWrite.clear(); ByteBufferPool.release(bufferToWrite); return null; }); |
