Browse Source

Java client: ByteBuffer.clear supports higher JDK versions

fix https://github.com/chrislusf/seaweedfs/issues/1836
pull/1844/head
Chris Lu 4 years ago
parent
commit
1d848641d7
  1. 3
      other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java

3
other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java

@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -217,7 +218,7 @@ public class SeaweedOutputStream extends OutputStream {
private synchronized int submitWriteBufferToService(final ByteBuffer bufferToWrite, final long writePosition) throws IOException { private synchronized int submitWriteBufferToService(final ByteBuffer bufferToWrite, final long writePosition) throws IOException {
bufferToWrite.flip();
((Buffer)bufferToWrite).flip();
int bytesLength = bufferToWrite.limit() - bufferToWrite.position(); int bytesLength = bufferToWrite.limit() - bufferToWrite.position();
if (threadExecutor.getQueue().size() >= maxConcurrentRequestCount) { if (threadExecutor.getQueue().size() >= maxConcurrentRequestCount) {

Loading…
Cancel
Save