Skip to content

Instantly share code, notes, and snippets.

@HeartSaVioR
Created March 5, 2014 12:39
Show Gist options
  • Save HeartSaVioR/9366408 to your computer and use it in GitHub Desktop.
Save HeartSaVioR/9366408 to your computer and use it in GitHub Desktop.
package net.heartsavior.dev;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.exceptions.JedisConnectionException;
public class JedisConnectionSuddenlyBrokenTest {
public static void main(String[] args) throws InterruptedException {
Jedis jedis = new Jedis("127.0.0.1", 6379);
for (int i = 0 ; i < 10000000 ; i++) {
try {
jedis.set("hello", "world");
if (i % 10000 == 0) {
System.out.println(i);
}
} catch (JedisConnectionException ex) {
System.out.println("JedisConnectionException - exc: " + ex);
} catch (Exception ex) {
System.out.println("Exception - exc: " + ex);
Thread.sleep(1000);
//break;
}
}
jedis.disconnect();
System.out.println("Done...");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment