Ok , I solved the problem... it was a long value assigned to int (I thought it was int as well)...
Thanks! :) -----Original Message----- From: Erez Naim [mailto:e...@theneura.com] Sent: Tuesday, December 1, 2015 12:18 PM To: JMeter Users List <user@jmeter.apache.org> Subject: RE: Java code Deepak, thanks for your quick response However, when I run this code in different thread group : import redis.clients.jedis.Jedis; //Connecting to Redis server on localhost Jedis jedis = new Jedis("host_server"); System.out.println("Connection to server sucessfully..."); // System.out.println("Server is running: "+jedis.ping()); int size = jedis.llen("sidekiq:queue:channels"); System.out.println("size is: " + size); while(jedis.llen("sidekiq:queue:channels")!=0)){ size = jedis.llen("sidekiq:queue:channels"); System.out.println("size is: " + size); } The while loop stops only after one iteration , although size value is not '0', this is what I get in console output: Connection to server sucessfully... size is: 10 it stops and this is not what I meant that will happen. Thanks in advanced ! --Erez-- -----Original Message----- From: Deepak Shetty [mailto:shet...@gmail.com] Sent: Monday, November 30, 2015 9:28 PM To: JMeter Users List <user@jmeter.apache.org> Subject: Re: Java code Hi If you are within a beanshell sampler then you just use java . > int jedisSize = jedis.llen("sidekiq:queue:channles"); You already have an int (Assuming your code is correct) so this is not needed >int size = vars.get("jedisSize"); //remove I am trying to use "size" in >while loop while(size != 0) { //do something - make sure you dont go in an infinite loop i.e. you have to keep reading size and it should become zero at some point in time } regards deepak On Mon, Nov 30, 2015 at 6:39 AM, Erez Naim <e...@theneura.com> wrote: > Hi all, > > I am using this piece of code under BeanShell Sampler: > > import redis.clients.jedis.Jedis; > > //Connecting to Redis server on localhost > Jedis jedis = new Jedis("54.214.48.139"); > System.out.println("Connection to server sucessfully"); > //System.out.println("Server is running: > "+jedis.ping()); > int jedisSize = jedis.llen("sidekiq:queue:channles"); > System.out.println("Server is full: " + jedisSize); > > int size = vars.get("jedisSize"); > > > I am trying to use "size" in while loop So I can use the following > condition: > > ${__javaScript("${jedisSize}" != 0 in the while loop... > > Any help of how to do it will be great ! > > --Erez-- >