diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-07-15 23:33:31 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-07-15 23:33:31 -0700 |
| commit | 7bca72deedb872402b4e597976eb198f3dad2d74 (patch) | |
| tree | ec8246e075538b1cae71f997a761f84a6d511c86 /other/java/client | |
| parent | 2286d27730ba0fd38654130ae8bb02181e3b45fb (diff) | |
| download | seaweedfs-7bca72deedb872402b4e597976eb198f3dad2d74.tar.xz seaweedfs-7bca72deedb872402b4e597976eb198f3dad2d74.zip | |
reuse bytebuffer
Diffstat (limited to 'other/java/client')
| -rw-r--r-- | other/java/client/pom.xml | 2 | ||||
| -rw-r--r-- | other/java/client/pom.xml.deploy | 2 | ||||
| -rw-r--r-- | other/java/client/pom_debug.xml | 2 | ||||
| -rw-r--r-- | other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java | 22 |
4 files changed, 25 insertions, 3 deletions
diff --git a/other/java/client/pom.xml b/other/java/client/pom.xml index 8cf72c02c..65493d5cf 100644 --- a/other/java/client/pom.xml +++ b/other/java/client/pom.xml @@ -5,7 +5,7 @@ <groupId>com.github.chrislusf</groupId> <artifactId>seaweedfs-client</artifactId> - <version>1.3.4</version> + <version>1.3.5</version> <parent> <groupId>org.sonatype.oss</groupId> diff --git a/other/java/client/pom.xml.deploy b/other/java/client/pom.xml.deploy index 8cf72c02c..65493d5cf 100644 --- a/other/java/client/pom.xml.deploy +++ b/other/java/client/pom.xml.deploy @@ -5,7 +5,7 @@ <groupId>com.github.chrislusf</groupId> <artifactId>seaweedfs-client</artifactId> - <version>1.3.4</version> + <version>1.3.5</version> <parent> <groupId>org.sonatype.oss</groupId> diff --git a/other/java/client/pom_debug.xml b/other/java/client/pom_debug.xml index c9a8247c4..d6fcfb11f 100644 --- a/other/java/client/pom_debug.xml +++ b/other/java/client/pom_debug.xml @@ -5,7 +5,7 @@ <groupId>com.github.chrislusf</groupId> <artifactId>seaweedfs-client</artifactId> - <version>1.3.4</version> + <version>1.3.5</version> <parent> <groupId>org.sonatype.oss</groupId> diff --git a/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java b/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java new file mode 100644 index 000000000..897fe9694 --- /dev/null +++ b/other/java/client/src/main/java/seaweedfs/client/ByteBufferPool.java @@ -0,0 +1,22 @@ +package seaweedfs.client; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; + +public class ByteBufferPool { + + static List<ByteBuffer> bufferList = new ArrayList<>(); + + public static synchronized ByteBuffer request(int bufferSize) { + if (bufferList.isEmpty()) { + return ByteBuffer.allocate(bufferSize); + } + return bufferList.remove(bufferList.size()-1); + } + + public static synchronized void release(ByteBuffer obj) { + bufferList.add(obj); + } + +} |
