I have a class that extends a RichFlatmapFunction in my Flink stream job. I create a Jedis instance in the open() method and close it (jedis.close()) in the close() method, so that all the records that pass through the transformation use the same Jedis instance. This approach has not given me any connection errors before. But in a recent job run, I got the error,
"redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset".
Could this be because I am using the same jedis instance (which remains open) for all the records? I have not set any timeout while creating the instance. So the timeout is also the default value.
Would I be able to avoid this error if I use JedisPool so as to retrieve and close Jedis instances for each record?