title: Jedis Bad file descriptor error
body: <p>I am writing to a redis database, by reading some data from text files. The code runs in a loop and adds to the database. The program runs fine for some time, but then I get the following runtime error.</p>
  
  <pre><code>Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: 
  java.net.SocketException: Bad file descriptor (Write failed)
      at redis.clients.jedis.Connection.flush(Connection.java:334)
      at redis.clients.jedis.Connection.getIntegerReply(Connection.java:263)
      at redis.clients.jedis.Jedis.rpush(Jedis.java:865)
      at clustering_words.SimilarWords.addSimilarWordsToRedis(SimilarWords.java:25)
      at clustering_words.SimilarWords.main(SimilarWords.java:77)
  Caused by: java.net.SocketException: Bad file descriptor (Write failed)
      at java.net.SocketOutputStream.socketWrite0(Native Method)
      at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
      at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
      at redis.clients.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:52)
      at redis.clients.util.RedisOutputStream.flush(RedisOutputStream.java:216)
      at redis.clients.jedis.Connection.flush(Connection.java:331)
      ... 4 more
  </code></pre>