Merge branch 'master' into 3.0.0

pull/802/merge
Nikita 8 years ago
commit a1da0c2a32

@ -2,6 +2,14 @@ Redisson Releases History
================================ ================================
####Please Note: trunk is current development branch. ####Please Note: trunk is current development branch.
####19-Dec-2016 - versions 2.7.2 and 3.2.2 released
Feature - `RList`, `RSet` and `RScoredSortedSet` implements `RSortable` interface with SORT command support
Feature - `NodeAsync` interface
Feature - `Node.info`, `Node.getNode` methods added
Fixed - elements distribution of `RBlockingFairQueue` across consumers
Fixed - `factory already defined` error during Redisson initialization under Apache Tomcat
####14-Dec-2016 - versions 2.7.1 and 3.2.1 released ####14-Dec-2016 - versions 2.7.1 and 3.2.1 released
Url format used in config files __has changed__. For example: Url format used in config files __has changed__. For example:

@ -6,10 +6,10 @@ Redis 2.8+ compatible.
| Stable Release Version | JDK Version compatibility | Release Date | | Stable Release Version | JDK Version compatibility | Release Date |
| ------------- | ------------- | ------------| | ------------- | ------------- | ------------|
| 3.2.1 | 1.8+ | 14.12.2016 | | 3.2.2 | 1.8+ | 19.12.2016 |
| 2.7.1 | 1.6+ | 14.12.2016 | | 2.7.2 | 1.6+ | 19.12.2016 |
__NOTE__: Both version lines have same features except `CompletionStage` interface support added in 3.x.x __NOTE__: Both version lines have same features except `CompletionStage` interface supported by 3.x.x line
Please read [documentation](https://github.com/redisson/redisson/wiki) for more details. Please read [documentation](https://github.com/redisson/redisson/wiki) for more details.
Redisson [releases history](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) Redisson [releases history](https://github.com/redisson/redisson/blob/master/CHANGELOG.md)
@ -74,7 +74,7 @@ Features
Who uses Redisson Who uses Redisson
================================ ================================
[Infor](http://www.infor.com/), [New Relic Synthetics](https://newrelic.com/synthetics), [Singtel](http://singtel.com), [Setronica](http://setronica.com/), [Monits](http://monits.com/), [Brookhaven National Laboratory](http://bnl.gov/), [Netflix Dyno client] (https://github.com/Netflix/dyno), [武林Q传](http://www.nbrpg.com/), [Ocous](http://www.ocous.com/), [Invaluable](http://www.invaluable.com/), [Clover](https://www.clover.com/) , [Apache Karaf Decanter](https://karaf.apache.org/projects.html#decanter), [Atmosphere Framework](http://async-io.org/), [BrandsEye](http://brandseye.com), [Datorama](http://datorama.com/), [BrightCloud](http://brightcloud.com/), [Azar](http://azarlive.com/) [Baidu](http://baidu.com), [Infor](http://www.infor.com/), [New Relic Synthetics](https://newrelic.com/synthetics), [Singtel](http://singtel.com), [Setronica](http://setronica.com/), [Monits](http://monits.com/), [Brookhaven National Laboratory](http://bnl.gov/), [Netflix Dyno client] (https://github.com/Netflix/dyno), [武林Q传](http://www.nbrpg.com/), [Ocous](http://www.ocous.com/), [Invaluable](http://www.invaluable.com/), [Clover](https://www.clover.com/) , [Apache Karaf Decanter](https://karaf.apache.org/projects.html#decanter), [Atmosphere Framework](http://async-io.org/), [BrandsEye](http://brandseye.com), [Datorama](http://datorama.com/), [BrightCloud](http://brightcloud.com/), [Azar](http://azarlive.com/)
Articles Articles
================================ ================================
@ -95,23 +95,23 @@ Quick start
<dependency> <dependency>
<groupId>org.redisson</groupId> <groupId>org.redisson</groupId>
<artifactId>redisson</artifactId> <artifactId>redisson</artifactId>
<version>3.2.1</version> <version>3.2.2</version>
</dependency> </dependency>
<!-- JDK 1.6+ compatible --> <!-- JDK 1.6+ compatible -->
<dependency> <dependency>
<groupId>org.redisson</groupId> <groupId>org.redisson</groupId>
<artifactId>redisson</artifactId> <artifactId>redisson</artifactId>
<version>2.7.1</version> <version>2.7.2</version>
</dependency> </dependency>
#### Gradle #### Gradle
// JDK 1.8+ compatible // JDK 1.8+ compatible
compile 'org.redisson:redisson:3.2.1' compile 'org.redisson:redisson:3.2.2'
// JDK 1.6+ compatible // JDK 1.6+ compatible
compile 'org.redisson:redisson:2.7.1' compile 'org.redisson:redisson:2.7.2'
#### Java #### Java
@ -136,11 +136,11 @@ RExecutorService executor = redisson.getExecutorService("myExecutorService");
Downloads Downloads
=============================== ===============================
[Redisson 3.2.1](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=3.2.1&e=jar), [Redisson 3.2.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=3.2.2&e=jar),
[Redisson node 3.2.1](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.2.1&e=jar) [Redisson node 3.2.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=3.2.2&e=jar)
[Redisson 2.7.1](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=2.7.1&e=jar), [Redisson 2.7.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson&v=2.7.2&e=jar),
[Redisson node 2.7.1](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=2.7.1&e=jar) [Redisson node 2.7.2](https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=org.redisson&a=redisson-all&v=2.7.2&e=jar)
### Supported by ### Supported by

@ -35,7 +35,6 @@ import org.redisson.client.protocol.decoder.ObjectMapReplayDecoder;
import org.redisson.command.CommandBatchService; import org.redisson.command.CommandBatchService;
import org.redisson.command.CommandExecutor; import org.redisson.command.CommandExecutor;
import io.netty.util.concurrent.Future;
import net.openhft.hashing.LongHashFunction; import net.openhft.hashing.LongHashFunction;
/** /**
@ -212,9 +211,19 @@ public class RedissonBloomFilter<T> extends RedissonExpirable implements RBloomF
@Override @Override
public boolean tryInit(long expectedInsertions, double falseProbability) { public boolean tryInit(long expectedInsertions, double falseProbability) {
if (falseProbability > 1) {
throw new IllegalArgumentException("Bloom filter false probability can't be greater than 1");
}
if (falseProbability < 0) {
throw new IllegalArgumentException("Bloom filter false probability can't be negative");
}
size = optimalNumOfBits(expectedInsertions, falseProbability); size = optimalNumOfBits(expectedInsertions, falseProbability);
if (size == 0) {
throw new IllegalArgumentException("Bloom filter calculated size is " + size);
}
if (size > MAX_SIZE) { if (size > MAX_SIZE) {
throw new IllegalArgumentException("Bloom filter can't be greater than " + MAX_SIZE + ". But calculated size is " + size); throw new IllegalArgumentException("Bloom filter size can't be greater than " + MAX_SIZE + ". But calculated size is " + size);
} }
hashIterations = optimalNumOfHashFunctions(expectedInsertions, size); hashIterations = optimalNumOfHashFunctions(expectedInsertions, size);

@ -110,23 +110,6 @@ public class RedissonLiveObjectService implements RLiveObjectService {
return ClassUtils.getField(proxied, "liveObjectLiveMap"); return ClassUtils.getField(proxied, "liveObjectLiveMap");
} }
@Override
public <T> T create(Class<T> entityClass) {
validateClass(entityClass);
try {
Class<? extends T> proxyClass = getProxyClass(entityClass);
Object id = generateId(entityClass);
T proxied = instantiateLiveObject(proxyClass, id);
if (!getMap(proxied).fastPut("redisson_live_object", "1")) {
throw new IllegalArgumentException("Object already exists");
}
return proxied;
} catch (Exception ex) {
unregisterClass(entityClass);
throw ex instanceof RuntimeException ? (RuntimeException) ex : new RuntimeException(ex);
}
}
private <T> Object generateId(Class<T> entityClass) throws NoSuchFieldException { private <T> Object generateId(Class<T> entityClass) throws NoSuchFieldException {
String idFieldName = getRIdFieldName(entityClass); String idFieldName = getRIdFieldName(entityClass);
RId annotation = entityClass RId annotation = entityClass
@ -149,18 +132,6 @@ public class RedissonLiveObjectService implements RLiveObjectService {
} }
} }
@Override
public <T, K> T getOrCreate(Class<T> entityClass, K id) {
try {
T proxied = instantiateLiveObject(getProxyClass(entityClass), id);
getMap(proxied).fastPut("redisson_live_object", "1");
return proxied;
} catch (Exception ex) {
unregisterClass(entityClass);
throw ex instanceof RuntimeException ? (RuntimeException) ex : new RuntimeException(ex);
}
}
@Override @Override
public <T> T attach(T detachedObject) { public <T> T attach(T detachedObject) {
validateDetached(detachedObject); validateDetached(detachedObject);

@ -45,7 +45,7 @@ public interface NodesGroup<N extends Node> {
/** /**
* Get Redis node by address in format: <code>host:port</code> * Get Redis node by address in format: <code>host:port</code>
* *
* @param address * @param address of node
* @return node * @return node
*/ */
N getNode(String address); N getNode(String address);

@ -18,8 +18,6 @@ package org.redisson.api;
/** /**
* Bloom filter based on 64-bit hash derived from 128-bit hash (xxHash + FarmHash). * Bloom filter based on 64-bit hash derived from 128-bit hash (xxHash + FarmHash).
* *
* Code parts from Guava BloomFilter
*
* @author Nikita Koksharov * @author Nikita Koksharov
* *
* @param <T> - type of object * @param <T> - type of object

@ -26,16 +26,6 @@ package org.redisson.api;
*/ */
public interface RLiveObjectService { public interface RLiveObjectService {
/**
* Use {@link #persist(Object)} method instead
*
* @param entityClass Entity class
* @param <T> Entity type
* @return Always returns a proxied object. Even it does not exist in redis.
*/
@Deprecated
<T> T create(Class<T> entityClass);
/** /**
* Finds the entity from Redis with the id. * Finds the entity from Redis with the id.
* *
@ -57,18 +47,6 @@ public interface RLiveObjectService {
*/ */
<T, K> T get(Class<T> entityClass, K id); <T, K> T get(Class<T> entityClass, K id);
/**
* Use {@link #persist(Object)} method instead
*
* @param entityClass Entity class
* @param id identifier
* @param <T> Entity type
* @param <K> Key type
* @return Always returns a proxied object. Even it does not exist in redis.
*/
@Deprecated
<T, K> T getOrCreate(Class<T> entityClass, K id);
/** /**
* Returns proxied object for the detached object. Discard all the * Returns proxied object for the detached object. Discard all the
* field values already in the detached instance. * field values already in the detached instance.

@ -300,7 +300,8 @@ public class CommandDecoder extends ReplayingDecoder<State> {
decodeList(in, data, parts, channel, size, respParts); decodeList(in, data, parts, channel, size, respParts);
} else { } else {
throw new IllegalStateException("Can't decode replay " + (char)code); String dataStr = in.toString(0, in.writerIndex(), CharsetUtil.UTF_8);
throw new IllegalStateException("Can't decode replay: " + dataStr);
} }
} }

@ -52,7 +52,13 @@ public class RedissonSpringCacheManager implements CacheManager, ResourceLoaderA
private String configLocation; private String configLocation;
public RedissonSpringCacheManager() { /**
* Creates CacheManager supplied by Redisson instance
*
* @param redisson object
*/
public RedissonSpringCacheManager(RedissonClient redisson) {
this(redisson, (String)null, null);
} }
/** /**

@ -7,6 +7,24 @@ import static org.assertj.core.api.Assertions.*;
public class RedissonBloomFilterTest extends BaseTest { public class RedissonBloomFilterTest extends BaseTest {
@Test(expected = IllegalArgumentException.class)
public void testFalseProbability1() {
RBloomFilter<String> filter = redisson.getBloomFilter("filter");
filter.tryInit(1, -1);
}
@Test(expected = IllegalArgumentException.class)
public void testFalseProbability2() {
RBloomFilter<String> filter = redisson.getBloomFilter("filter");
filter.tryInit(1, 2);
}
@Test(expected = IllegalArgumentException.class)
public void testSizeZero() {
RBloomFilter<String> filter = redisson.getBloomFilter("filter");
filter.tryInit(1, 1);
}
@Test @Test
public void testConfig() { public void testConfig() {
RBloomFilter<String> filter = redisson.getBloomFilter("filter"); RBloomFilter<String> filter = redisson.getBloomFilter("filter");

Loading…
Cancel
Save