transactions - ERR EXEC without MULTI - Jedis -


i'm learning jedis, couldn't find out problem in code. can me.the exception occurs @ statement tx.exec()

public class jedisfactory {   public static void main (string [] args){      jedispool pool = new jedispool(new jedispoolconfig(), "127.0.0.1", 6379);      jedis jedis = pool.getresource();       pipeline pipeline = jedis.pipelined();      for(int i=0; < 1000 ; i++){          pipeline.hincrby("id", i+"", i);      }      pipeline.exec();              pool.returnresource(jedis);       jedis = pool.getresource();      transaction tx = jedis.multi();      response<map<string,string>> map = tx.hgetall("id");      tx.hincrby("id","2", 1);      **tx.exec();**      //map<string,string> map1 = jedis.hgetall("id");       pool.returnresource(jedis);      pool.destroy();  } } exception in thread "main" redis.clients.jedis.exceptions.jedisdataexception: err exec without multi     @ redis.clients.jedis.protocol.processerror(protocol.java:54)     @ redis.clients.jedis.protocol.process(protocol.java:61)     @ redis.clients.jedis.protocol.read(protocol.java:122)     @ redis.clients.jedis.connection.getall(connection.java:207)     @ redis.clients.jedis.binarytransaction.exec(binarytransaction.java:23)     @ com.work.jedisfactory.main(jedisfactory.java:30) 

adding pipeline.multi() before loop solved problem. exception thrown @ other line before fix.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -