Skip to content

Commit 4d33119

Browse files
authored
Configure socket buffer size through system property (#2915)
1 parent 54f2b59 commit 4d33119

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/java/redis/clients/jedis/util/RedisInputStream.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
*/
2323
public class RedisInputStream extends FilterInputStream {
2424

25+
private static final int INPUT_BUFFER_SIZE = Integer.parseInt(
26+
System.getProperty("jedis.bufferSize.input",
27+
System.getProperty("jedis.bufferSize", "8192")));
28+
2529
protected final byte[] buf;
2630

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

3741
public RedisInputStream(InputStream in) {
38-
this(in, 8192);
42+
this(in, INPUT_BUFFER_SIZE);
3943
}
4044

4145
public byte readByte() throws JedisConnectionException {

src/main/java/redis/clients/jedis/util/RedisOutputStream.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
* used outside Jedis
1111
*/
1212
public final class RedisOutputStream extends FilterOutputStream {
13+
14+
private static final int OUTPUT_BUFFER_SIZE = Integer.parseInt(
15+
System.getProperty("jedis.bufferSize.output",
16+
System.getProperty("jedis.bufferSize", "8192")));
17+
1318
protected final byte[] buf;
1419

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

3843
public RedisOutputStream(final OutputStream out) {
39-
this(out, 8192);
44+
this(out, OUTPUT_BUFFER_SIZE);
4045
}
4146

4247
public RedisOutputStream(final OutputStream out, final int size) {

0 commit comments

Comments
 (0)