Search in sources :

Example 6 with CommandData

use of org.redisson.client.protocol.CommandData in project redisson by redisson.

the class RedisClientTest method testPipelineBigResponse.

@Test
public void testPipelineBigResponse() throws InterruptedException, ExecutionException {
    RedisClient c = new RedisClient(RedisRunner.getDefaultRedisServerBindAddressAndPort());
    RedisConnection conn = c.connect();
    List<CommandData<?, ?>> commands = new ArrayList<CommandData<?, ?>>();
    for (int i = 0; i < 1000; i++) {
        CommandData<String, String> cmd1 = conn.create(null, RedisCommands.PING);
        commands.add(cmd1);
    }
    RPromise<Void> p = new RedissonPromise<Void>();
    conn.send(new CommandsData(p, commands));
    for (CommandData<?, ?> commandData : commands) {
        commandData.getPromise().get();
    }
    conn.sync(RedisCommands.FLUSHDB);
}
Also used : RedissonPromise(org.redisson.misc.RedissonPromise) ArrayList(java.util.ArrayList) RedisClient(org.redisson.client.RedisClient) CommandsData(org.redisson.client.protocol.CommandsData) CommandData(org.redisson.client.protocol.CommandData) RedisConnection(org.redisson.client.RedisConnection) Test(org.junit.Test)

Aggregations

CommandData (org.redisson.client.protocol.CommandData)6 CommandsData (org.redisson.client.protocol.CommandsData)5 ArrayList (java.util.ArrayList)4 RedisConnection (org.redisson.client.RedisConnection)4 RedisAskException (org.redisson.client.RedisAskException)3 RedisLoadingException (org.redisson.client.RedisLoadingException)3 RedisMovedException (org.redisson.client.RedisMovedException)3 RedisTimeoutException (org.redisson.client.RedisTimeoutException)3 RedisTryAgainException (org.redisson.client.RedisTryAgainException)3 ChannelFuture (io.netty.channel.ChannelFuture)2 ChannelFutureListener (io.netty.channel.ChannelFutureListener)2 Test (org.junit.Test)2 RedisClient (org.redisson.client.RedisClient)2 RedisException (org.redisson.client.RedisException)2 WriteRedisConnectionException (org.redisson.client.WriteRedisConnectionException)2 QueueCommand (org.redisson.client.protocol.QueueCommand)2 RedissonPromise (org.redisson.misc.RedissonPromise)2 Timeout (io.netty.util.Timeout)1 TimerTask (io.netty.util.TimerTask)1 IOException (java.io.IOException)1