RBlockingDeque added to RBatch. #320

pull/337/head
Nikita 9 years ago
parent 74d7f0d8bc
commit 364fb2360f

@ -23,6 +23,7 @@ import org.redisson.connection.ConnectionManager;
import org.redisson.core.RAtomicLongAsync; import org.redisson.core.RAtomicLongAsync;
import org.redisson.core.RBatch; import org.redisson.core.RBatch;
import org.redisson.core.RBitSetAsync; import org.redisson.core.RBitSetAsync;
import org.redisson.core.RBlockingDequeAsync;
import org.redisson.core.RBlockingQueueAsync; import org.redisson.core.RBlockingQueueAsync;
import org.redisson.core.RBucketAsync; import org.redisson.core.RBucketAsync;
import org.redisson.core.RMapCacheAsync; import org.redisson.core.RMapCacheAsync;
@ -138,17 +139,27 @@ public class RedissonBatch implements RBatch {
} }
@Override @Override
public <V> RDequeAsync<V> getDequeAsync(String name) { public <V> RBlockingDequeAsync<V> getBlockingDeque(String name) {
return new RedissonBlockingDeque<V>(executorService, name);
}
@Override
public <V> RBlockingDequeAsync<V> getBlockingDeque(String name, Codec codec) {
return new RedissonBlockingDeque<V>(codec, executorService, name);
}
@Override
public <V> RDequeAsync<V> getDeque(String name) {
return new RedissonDeque<V>(executorService, name); return new RedissonDeque<V>(executorService, name);
} }
@Override @Override
public <V> RDequeAsync<V> getDequeAsync(String name, Codec codec) { public <V> RDequeAsync<V> getDeque(String name, Codec codec) {
return new RedissonDeque<V>(codec, executorService, name); return new RedissonDeque<V>(codec, executorService, name);
} }
@Override @Override
public RAtomicLongAsync getAtomicLongAsync(String name) { public RAtomicLongAsync getAtomicLong(String name) {
return new RedissonAtomicLong(executorService, name); return new RedissonAtomicLong(executorService, name);
} }

@ -467,7 +467,7 @@ public interface RedissonClient {
RBatch createBatch(); RBatch createBatch();
/** /**
* Returns keys operations. * Returns interface with methods for Redis keys.
* Each of Redis/Redisson object associated with own key * Each of Redis/Redisson object associated with own key
* *
* @return * @return

@ -172,9 +172,19 @@ public interface RBatch {
* @param name of deque * @param name of deque
* @return * @return
*/ */
<V> RDequeAsync<V> getDequeAsync(String name); <V> RDequeAsync<V> getDeque(String name);
<V> RDequeAsync<V> getDequeAsync(String name, Codec codec); <V> RDequeAsync<V> getDeque(String name, Codec codec);
/**
* Returns blocking deque instance by name.
*
* @param name of queue
* @return
*/
<V> RBlockingDequeAsync<V> getBlockingDeque(String name);
<V> RBlockingDequeAsync<V> getBlockingDeque(String name, Codec codec);
/** /**
* Returns "atomic long" instance by name. * Returns "atomic long" instance by name.
@ -182,7 +192,7 @@ public interface RBatch {
* @param name of the "atomic long" * @param name of the "atomic long"
* @return * @return
*/ */
RAtomicLongAsync getAtomicLongAsync(String name); RAtomicLongAsync getAtomicLong(String name);
/** /**
* Returns Redis Sorted Set instance by name * Returns Redis Sorted Set instance by name

@ -48,8 +48,8 @@ public class RedissonBatchTest extends BaseTest {
batch.getMap("test").fastPutAsync("1", "2"); batch.getMap("test").fastPutAsync("1", "2");
batch.getMap("test").fastPutAsync("2", "3"); batch.getMap("test").fastPutAsync("2", "3");
batch.getMap("test").putAsync("2", "5"); batch.getMap("test").putAsync("2", "5");
batch.getAtomicLongAsync("counter").incrementAndGetAsync(); batch.getAtomicLong("counter").incrementAndGetAsync();
batch.getAtomicLongAsync("counter").incrementAndGetAsync(); batch.getAtomicLong("counter").incrementAndGetAsync();
} }
List<?> res = batch.execute(); List<?> res = batch.execute();
Assert.assertEquals(210*5, res.size()); Assert.assertEquals(210*5, res.size());
@ -84,8 +84,8 @@ public class RedissonBatchTest extends BaseTest {
batch.getMap("test").fastPutAsync("1", "2"); batch.getMap("test").fastPutAsync("1", "2");
batch.getMap("test").fastPutAsync("2", "3"); batch.getMap("test").fastPutAsync("2", "3");
batch.getMap("test").putAsync("2", "5"); batch.getMap("test").putAsync("2", "5");
batch.getAtomicLongAsync("counter").incrementAndGetAsync(); batch.getAtomicLong("counter").incrementAndGetAsync();
batch.getAtomicLongAsync("counter").incrementAndGetAsync(); batch.getAtomicLong("counter").incrementAndGetAsync();
List<?> res = batch.execute(); List<?> res = batch.execute();
Assert.assertEquals(5, res.size()); Assert.assertEquals(5, res.size());

Loading…
Cancel
Save