Skip to content

Commit 187e317

Browse files
committed
#22 add new Ctor accepting Jedis poool
1 parent f229866 commit 187e317

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/main/java/com/redislabs/redisgraph/RedisGraphAPI.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
import redis.clients.jedis.Jedis;
77
import redis.clients.jedis.JedisPool;
88
import redis.clients.jedis.commands.ProtocolCommand;
9+
import redis.clients.jedis.util.Pool;
910

1011
/**
1112
* RedisGraph client
1213
*/
1314
public class RedisGraphAPI {
1415

15-
final private JedisPool client;
16+
final private Pool<Jedis> client;
1617
final private String graphId;
1718

1819
/**
@@ -32,8 +33,18 @@ public RedisGraphAPI(String graphId) {
3233
* @param port Redis port
3334
*/
3435
public RedisGraphAPI(String graphId, String host, int port) {
36+
this(graphId, new JedisPool(host, port));
37+
}
38+
39+
/**
40+
* Creates a client to a specific graph using provided Jedis pool
41+
*
42+
* @param graphId the graph id
43+
* @param jedis bring your own Jedis pool
44+
*/
45+
public RedisGraphAPI(String graphId, Pool<Jedis> jedis) {
3546
this.graphId = graphId;
36-
this.client = new JedisPool(host, port);
47+
this.client = jedis;
3748
}
3849

3950
/**

0 commit comments

Comments
 (0)