jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Java code
Date Mon, 30 Nov 2015 19:27:43 GMT
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 <Erez@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--
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message