Multiple simultaneous pipelines

25 views
Skip to first unread message

praveen...@blippar.com

unread,
Oct 12, 2017, 5:08:34 PM10/12/17
to Jedis
I'm trying to create multiple pipelines with Jedis simultaneously and that doesn't seem to work. Is this not supposed to work?

public static void main(final String[] args) {

    try(final Jedis jedis = new Jedis()) {

      final Pipeline p1 = jedis.pipelined();

      final Pipeline p2 = jedis.pipelined();

      

      p1.set("a", "1");

      p2.set("c", "3");


      p1.sync();

      p2.sync();


      System.out.println(jedis.get("a"));

      System.out.println(jedis.get("c"));

    }

  }


Throws:

Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: Cannot use Jedis when in Pipeline. Please use Pipeline or reset jedis state .

at redis.clients.jedis.BinaryJedis.checkIsInMultiOrPipeline(BinaryJedis.java:1761)

at redis.clients.jedis.Jedis.get(Jedis.java:151)


Reply all
Reply to author
Forward
0 new messages