Search code examples
redisjedis

What does parameters like timeout, connectionTimeout, soTimeout, and infiniteSoTimeout mean in JedisPool?


While defining a jedisPool object, various functions can be chosen from with varying parameters. I want to know what these parameters

  • timeout
  • connectionTimeout
  • soTimeout
  • infiniteSoTimeout

mean?


Solution

  • Jedis uses java.net.Socket under the hood. The concerned parameters are all directly related to that Socket. Also, the naming of parameters comes mostly from there.

    • connectionTimeout - timeout value (in milliseconds) to be used while establishing a socket connection.
    • soTimeout/socketTimeout - timeout value (in milliseconds) to be used while waiting for a response from Redis server (during a regular command execution)
    • timeout - this is simply a shortcut to use same value for both connectionTimeout and soTimeout
    • infiniteSoTimeout/blockingSoTimeout - timeout value (in milliseconds) to be used while waiting for a response from Redis server during a blocking command execution. For example, BLPOP is a blocking command.