Search in sources :

Example 6 with RedissonPromise

use of org.redisson.misc.RedissonPromise 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

RedissonPromise (org.redisson.misc.RedissonPromise)6 RedisConnection (org.redisson.client.RedisConnection)3 ChannelFuture (io.netty.channel.ChannelFuture)2 ChannelFutureListener (io.netty.channel.ChannelFutureListener)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 RedisClient (org.redisson.client.RedisClient)2 CommandData (org.redisson.client.protocol.CommandData)2 CommandsData (org.redisson.client.protocol.CommandsData)2 RedissonShutdownException (org.redisson.RedissonShutdownException)1 RedisException (org.redisson.client.RedisException)1