Fixed small bug in the benchmark test
This commit is contained in:
@@ -25,7 +25,7 @@ public class PoolBenchmark {
|
||||
// withoutPool();
|
||||
withPool();
|
||||
long elapsed = System.currentTimeMillis() - t;
|
||||
System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
|
||||
System.out.println(((1000 * 3 * TOTAL_OPERATIONS) / elapsed) + " ops");
|
||||
}
|
||||
|
||||
private static void withoutPool() throws InterruptedException {
|
||||
@@ -70,9 +70,10 @@ public class PoolBenchmark {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
Thread hj = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
for(int i = 0; (i = ind.getAndIncrement()) < TOTAL_OPERATIONS; ) {
|
||||
for (int i = 0; (i = ind.getAndIncrement()) < TOTAL_OPERATIONS;) {
|
||||
try {
|
||||
Jedis j = pool.getResource();
|
||||
j.auth("foobared");
|
||||
final String key = "foo" + i;
|
||||
j.set(key, key);
|
||||
j.get(key);
|
||||
@@ -87,7 +88,7 @@ public class PoolBenchmark {
|
||||
hj.start();
|
||||
}
|
||||
|
||||
for(Thread t : tds)
|
||||
for (Thread t : tds)
|
||||
t.join();
|
||||
|
||||
pool.destroy();
|
||||
|
||||
Reference in New Issue
Block a user