pollLastAndOfferFirstToAsync added

pull/243/head
Nikita 10 years ago
parent c996553608
commit 3f55d2fc7a

@ -21,6 +21,8 @@ import org.redisson.client.protocol.RedisCommands;
import org.redisson.connection.ConnectionManager;
import org.redisson.core.RQueue;
import io.netty.util.concurrent.Future;
/**
* Distributed and concurrent implementation of {@link java.util.Queue}
*
@ -80,7 +82,17 @@ public class RedissonQueue<V> extends RedissonList<V> implements RQueue<V> {
@Override
public V pollLastAndOfferFirstTo(String queueName) {
return connectionManager.write(getName(), RedisCommands.RPOPLPUSH, getName(), queueName);
return connectionManager.get(pollLastAndOfferFirstToAsync(queueName));
}
@Override
public Future<V> pollLastAndOfferFirstToAsync(String queueName) {
return connectionManager.writeAsync(getName(), RedisCommands.RPOPLPUSH, getName(), queueName);
}
@Override
public Future<V> pollLastAndOfferFirstToAsync(RQueue<V> queue) {
return pollLastAndOfferFirstToAsync(queue.getName());
}
@Override

@ -17,6 +17,8 @@ package org.redisson.core;
import java.util.Queue;
import io.netty.util.concurrent.Future;
/**
* {@link java.util.Queue} backed by Redis
*
@ -26,8 +28,12 @@ import java.util.Queue;
*/
public interface RQueue<V> extends Queue<V>, RExpirable {
Future<V> pollLastAndOfferFirstToAsync(RQueue<V> queue);
Future<V> pollLastAndOfferFirstToAsync(String queueName);
V pollLastAndOfferFirstTo(String dequeName);
V pollLastAndOfferFirstTo(RQueue<V> deque);
}

Loading…
Cancel
Save