getBucket(String name, Codec codec);
/**
- * Returns a list of object holder instances by a key pattern.
- *
- *
Supported glob-style patterns:
- * h?llo subscribes to hello, hallo and hxllo
- * h*llo subscribes to hllo and heeeello
- * h[ae]llo subscribes to hello and hallo, but not hillo
- * h[^e]llo matches hallo, hbllo, ... but not hello
- * h[a-b]llo matches hallo and hbllo
- * Use \ to escape special characters if you want to match them verbatim.
- *
- *
Uses KEYS
Redis command.
+ * Returns interface for mass operations with Bucket objects.
*
- * @param pattern
* @return
*/
- List> findBuckets(String pattern);
+ RBuckets getBuckets();
/**
- * Returns Redis object mapped by key. Result Map is not contains
- * key-value entry for null values.
- *
- *
Uses MGET
Redis command.
+ * Returns interface for mass operations with Bucket objects
+ * using provided codec for object.
*
- * @param keys
* @return
*/
- Map loadBucketValues(Collection keys);
+ RBuckets getBuckets(Codec codec);
/**
- * Returns Redis object mapped by key. Result Map is not contains
- * key-value entry for null values.
- *
- *
Uses MGET
Redis command.
- *
- * @param keys
- * @return
+ * Use {@link RBuckets#find(String)}
*/
- Map loadBucketValues(String ... keys);
+ @Deprecated
+ List> findBuckets(String pattern);
/**
- * Saves Redis object mapped by key.
- *
- * @param buckets
+ * Use {@link RBuckets#get(String...)}
*/
- void saveBuckets(Map buckets);
+ @Deprecated
+ Map loadBucketValues(Collection keys);
+
+ /**
+ * Use {@link RBuckets#get(String...)}
+ */
+ @Deprecated
+ Map loadBucketValues(String ... keys);
/**
- * Use {@link #findBuckets(String)}
+ * Use {@link RBuckets#set(Map)}
*/
@Deprecated
- List> getBuckets(String pattern);
+ void saveBuckets(Map buckets);
/**
* Returns HyperLogLog instance by name.
@@ -587,12 +594,20 @@ public interface RedissonClient {
RScript getScript();
/**
- * Returns object for remote operations
+ * Returns object for remote operations prefixed with the default name (redisson_remote_service)
*
* @return
*/
RRemoteService getRemoteSerivce();
-
+
+ /**
+ * Returns object for remote operations prefixed with the specified name
+ *
+ * @param name The name used as the Redis key prefix for the services
+ * @return
+ */
+ RRemoteService getRemoteSerivce(String name);
+
/**
* Return batch object which executes group of
* command in pipeline.
@@ -613,8 +628,24 @@ public interface RedissonClient {
/**
* Shuts down Redisson instance NOT Redis server
+ *
+ * This equates to invoke shutdown(2, 15, TimeUnit.SECONDS);
*/
void shutdown();
+
+ /**
+ * Shuts down Redisson instance NOT Redis server
+ *
+ * Shutdown ensures that no tasks are submitted for 'the quiet period'
+ * (usually a couple seconds) before it shuts itself down. If a task is submitted during the quiet period,
+ * it is guaranteed to be accepted and the quiet period will start over.
+ *
+ * @param quietPeriod the quiet period as described in the documentation
+ * @param timeout the maximum amount of time to wait until the executor is {@linkplain #shutdown()}
+ * regardless if a task was submitted during the quiet period
+ * @param unit the unit of {@code quietPeriod} and {@code timeout}
+ */
+ void shutdown(long quietPeriod, long timeout, TimeUnit unit);
/**
* Allows to get configuration provided
@@ -639,18 +670,6 @@ public interface RedissonClient {
*/
NodesGroup getClusterNodesGroup();
- /**
- * Use {@link RKeys#flushdb()}
- */
- @Deprecated
- void flushdb();
-
- /**
- * Use {@link RKeys#flushall()}
- */
- @Deprecated
- void flushall();
-
/**
* Returns {@code true} if this Redisson instance has been shut down.
*
diff --git a/src/main/java/org/redisson/RedissonCountDownLatch.java b/src/main/java/org/redisson/RedissonCountDownLatch.java
index 8f3eeef1f..5a4d660a6 100644
--- a/src/main/java/org/redisson/RedissonCountDownLatch.java
+++ b/src/main/java/org/redisson/RedissonCountDownLatch.java
@@ -53,7 +53,7 @@ public class RedissonCountDownLatch extends RedissonObject implements RCountDown
public void await() throws InterruptedException {
Future promise = subscribe();
try {
- promise.await();
+ get(promise);
while (getCount() > 0) {
// waiting for open state
@@ -71,7 +71,7 @@ public class RedissonCountDownLatch extends RedissonObject implements RCountDown
public boolean await(long time, TimeUnit unit) throws InterruptedException {
Future promise = subscribe();
try {
- if (!promise.await(time, unit)) {
+ if (!await(promise, time, unit)) {
return false;
}
diff --git a/src/main/java/org/redisson/RedissonExpirable.java b/src/main/java/org/redisson/RedissonExpirable.java
index 9bebf502e..87a3d4b37 100644
--- a/src/main/java/org/redisson/RedissonExpirable.java
+++ b/src/main/java/org/redisson/RedissonExpirable.java
@@ -58,12 +58,12 @@ abstract class RedissonExpirable extends RedissonObject implements RExpirable {
@Override
public boolean expireAt(Date timestamp) {
- return expireAt(timestamp.getTime() / 1000);
+ return expireAt(timestamp.getTime());
}
@Override
public Future expireAtAsync(Date timestamp) {
- return expireAtAsync(timestamp.getTime() / 1000);
+ return expireAtAsync(timestamp.getTime());
}
@Override
diff --git a/src/main/java/org/redisson/RedissonGeo.java b/src/main/java/org/redisson/RedissonGeo.java
new file mode 100644
index 000000000..20ca9a3d1
--- /dev/null
+++ b/src/main/java/org/redisson/RedissonGeo.java
@@ -0,0 +1,197 @@
+/**
+ * Copyright 2014 Nikita Koksharov, Nickolay Borbit
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.redisson;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.redisson.client.codec.Codec;
+import org.redisson.client.codec.GeoEntryCodec;
+import org.redisson.client.codec.ScoredCodec;
+import org.redisson.client.protocol.RedisCommand;
+import org.redisson.client.protocol.RedisCommand.ValueType;
+import org.redisson.client.protocol.RedisCommands;
+import org.redisson.client.protocol.decoder.GeoDistanceDecoder;
+import org.redisson.client.protocol.decoder.GeoMapReplayDecoder;
+import org.redisson.client.protocol.decoder.GeoPositionDecoder;
+import org.redisson.client.protocol.decoder.GeoPositionMapDecoder;
+import org.redisson.client.protocol.decoder.MultiDecoder;
+import org.redisson.client.protocol.decoder.NestedMultiDecoder;
+import org.redisson.client.protocol.decoder.FlatNestedMultiDecoder;
+import org.redisson.command.CommandAsyncExecutor;
+import org.redisson.connection.decoder.MapGetAllDecoder;
+import org.redisson.core.GeoEntry;
+import org.redisson.core.GeoPosition;
+import org.redisson.core.GeoUnit;
+import org.redisson.core.RGeo;
+
+import io.netty.util.concurrent.Future;
+
+public class RedissonGeo extends RedissonExpirable implements RGeo {
+
+ MultiDecoder