findKeysByPattern response interface changed

pull/243/head
Nikita 10 years ago
parent fcd72d9ba8
commit aea51b6f66

@ -15,6 +15,7 @@
*/ */
package org.redisson; package org.redisson;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Queue; import java.util.Queue;
@ -71,7 +72,7 @@ public interface CommandExecutor {
<T, R> R write(String key, RedisCommand<T> command, Object ... params); <T, R> R write(String key, RedisCommand<T> command, Object ... params);
<T, R> Future<Queue<R>> readAllAsync(RedisCommand<T> command, Object ... params); <T, R> Future<Collection<R>> readAllAsync(RedisCommand<T> command, Object ... params);
<T> Future<Void> writeAllAsync(RedisCommand<T> command, Object ... params); <T> Future<Void> writeAllAsync(RedisCommand<T> command, Object ... params);

@ -68,8 +68,8 @@ public class CommandExecutorService implements CommandExecutor {
return connectionManager; return connectionManager;
} }
public <T, R> Future<Queue<R>> readAllAsync(RedisCommand<T> command, Object ... params) { public <T, R> Future<Collection<R>> readAllAsync(RedisCommand<T> command, Object ... params) {
final Promise<Queue<R>> mainPromise = connectionManager.newPromise(); final Promise<Collection<R>> mainPromise = connectionManager.newPromise();
Promise<R> promise = new DefaultPromise<R>() { Promise<R> promise = new DefaultPromise<R>() {
Queue<R> results = new ConcurrentLinkedQueue<R>(); Queue<R> results = new ConcurrentLinkedQueue<R>();
AtomicInteger counter = new AtomicInteger(connectionManager.getEntries().keySet().size()); AtomicInteger counter = new AtomicInteger(connectionManager.getEntries().keySet().size());

@ -16,9 +16,9 @@
package org.redisson; package org.redisson;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Queue;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -125,8 +125,8 @@ public class Redisson implements RedissonClient {
*/ */
@Override @Override
public <V> List<RBucket<V>> getBuckets(String pattern) { public <V> List<RBucket<V>> getBuckets(String pattern) {
Future<Queue<String>> r = commandExecutor.readAllAsync(RedisCommands.KEYS, pattern); Future<Collection<String>> r = commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
Queue<String> keys = commandExecutor.get(r); Collection<String> keys = commandExecutor.get(r);
List<RBucket<V>> buckets = new ArrayList<RBucket<V>>(keys.size()); List<RBucket<V>> buckets = new ArrayList<RBucket<V>>(keys.size());
for (Object key : keys) { for (Object key : keys) {
if(key != null) { if(key != null) {
@ -326,7 +326,7 @@ public class Redisson implements RedissonClient {
* @return * @return
*/ */
@Override @Override
public Queue<String> findKeysByPattern(String pattern) { public Collection<String> findKeysByPattern(String pattern) {
return commandExecutor.get(findKeysByPatternAsync(pattern)); return commandExecutor.get(findKeysByPatternAsync(pattern));
} }
@ -342,7 +342,7 @@ public class Redisson implements RedissonClient {
* @return * @return
*/ */
@Override @Override
public Future<Queue<String>> findKeysByPatternAsync(String pattern) { public Future<Collection<String>> findKeysByPatternAsync(String pattern) {
return commandExecutor.readAllAsync(RedisCommands.KEYS, pattern); return commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
} }

@ -15,12 +15,27 @@
*/ */
package org.redisson; package org.redisson;
import org.redisson.core.*; import java.util.Collection;
import java.util.List;
import io.netty.util.concurrent.Future; import org.redisson.core.RAtomicLong;
import org.redisson.core.RBatch;
import org.redisson.core.RBlockingQueue;
import org.redisson.core.RBucket;
import org.redisson.core.RCountDownLatch;
import org.redisson.core.RDeque;
import org.redisson.core.RHyperLogLog;
import org.redisson.core.RList;
import org.redisson.core.RLock;
import org.redisson.core.RMap;
import org.redisson.core.RPatternTopic;
import org.redisson.core.RQueue;
import org.redisson.core.RScript;
import org.redisson.core.RSet;
import org.redisson.core.RSortedSet;
import org.redisson.core.RTopic;
import java.util.List; import io.netty.util.concurrent.Future;
import java.util.Queue;
public interface RedissonClient { public interface RedissonClient {
@ -188,7 +203,7 @@ public interface RedissonClient {
* @param pattern * @param pattern
* @return * @return
*/ */
Queue<String> findKeysByPattern(String pattern); Collection<String> findKeysByPattern(String pattern);
/** /**
* Find keys by key search pattern in async mode * Find keys by key search pattern in async mode
@ -201,7 +216,7 @@ public interface RedissonClient {
* @param pattern * @param pattern
* @return * @return
*/ */
Future<Queue<String>> findKeysByPatternAsync(String pattern); Future<Collection<String>> findKeysByPatternAsync(String pattern);
/** /**
* Delete multiple objects by a key pattern * Delete multiple objects by a key pattern

Loading…
Cancel
Save