Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure socket buffer size through system property #2915

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/redis/clients/jedis/util/RedisInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
*/
public class RedisInputStream extends FilterInputStream {

private static final int INPUT_BUFFER_SIZE = Integer.parseInt(
System.getProperty("jedis.bufferSize.input",
System.getProperty("jedis.bufferSize", "8192")));

protected final byte[] buf;

protected int count, limit;
Expand All @@ -35,7 +39,7 @@ public RedisInputStream(InputStream in, int size) {
}

public RedisInputStream(InputStream in) {
this(in, 8192);
this(in, INPUT_BUFFER_SIZE);
}

public byte readByte() throws JedisConnectionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
* used outside Jedis
*/
public final class RedisOutputStream extends FilterOutputStream {

private static final int OUTPUT_BUFFER_SIZE = Integer.parseInt(
System.getProperty("jedis.bufferSize.output",
System.getProperty("jedis.bufferSize", "8192")));

protected final byte[] buf;

protected int count;
Expand All @@ -36,7 +41,7 @@ public final class RedisOutputStream extends FilterOutputStream {
't', 'u', 'v', 'w', 'x', 'y', 'z' };

public RedisOutputStream(final OutputStream out) {
this(out, 8192);
this(out, OUTPUT_BUFFER_SIZE);
}

public RedisOutputStream(final OutputStream out, final int size) {
Expand Down