Merge branch 'master' into 3.0.0

pull/1821/head
Nikita 7 years ago
commit 9be182d6ec

@ -1,6 +1,6 @@
Redisson: Redis based In-Memory Data Grid for Java.
====
[Quick start](https://github.com/redisson/redisson#quick-start) | [Documentation](https://github.com/redisson/redisson/wiki) | [Javadocs](http://www.javadoc.io/doc/org.redisson/redisson/3.5.7) | [Changelog](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) | [Code examples](https://github.com/redisson/redisson-examples) | [Support chat](https://gitter.im/mrniko/redisson) | **[PRO version](https://redisson.pro)**
[Quick start](https://github.com/redisson/redisson#quick-start) | [Documentation](https://github.com/redisson/redisson/wiki) | [Javadocs](http://www.javadoc.io/doc/org.redisson/redisson/3.5.7) | [Changelog](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) | [Code examples](https://github.com/redisson/redisson-examples) | [Support chat](https://gitter.im/mrniko/redisson) | **[Redisson PRO](https://redisson.pro)**
Based on high-performance async and lock-free Java Redis client and [Netty](http://netty.io) framework.
@ -53,24 +53,30 @@ Features
Used by
================================
[![Jeppesen](https://redisson.org/assets/logos/client25.png "Jeppesen")](https://www.jeppesen.com/)    
[![AIG](https://redisson.org/assets/logos/client24.png "AIG")](https://www.aig.com/)    
[![Adobe](https://redisson.org/assets/logos/client23.png "Adobe")](https://www.adobe.com/)    
[![S&P Global](https://redisson.org/assets/logos/client20.png "S&P Global")](https://www.spglobal.com/)    
[![SAP](https://redisson.org/assets/logos/client12.png "SAP")](http://www.sap.com/)    
[![EA](https://redisson.org/assets/logos/client1.png "EA")](http://ea.com/)    
[![BROOKHAVEN](https://redisson.org/assets/logos/client6.png "Brookhaven National Laboratory")](http://bnl.gov/)    
[![New Relic Synthetics](https://redisson.org/assets/logos/client3.png "New Relic Synthetics")](http://newrelic.com/synthetics)    
[![BROOKHAVEN](https://redisson.org/assets/logos/client6.png "Brookhaven National Laboratory")](http://bnl.gov/)
[![New Relic Synthetics](https://redisson.org/assets/logos/client3.png "New Relic Synthetics")](http://newrelic.com/synthetics)    
[![Singtel](https://redisson.org/assets/logos/client5.png "New Relic Synthetics")](http://singtel.com/)    
[![Netflix](https://redisson.org/assets/logos/client10.png "Netflix")](https://netflix.com/)
[![Netflix](https://redisson.org/assets/logos/client10.png "Netflix")](https://netflix.com/)    
[![Baidu](https://redisson.org/assets/logos/client2.png "Baidu")](http://baidu.com/)    
[![Infor](https://redisson.org/assets/logos/client4.png "Infor")](http://www.infor.com/)    
[![Crimson Hexagon](https://redisson.org/assets/logos/client7.png "Crimson Hexagon")](https://www.crimsonhexagon.com/)    
[![Crimson Hexagon](https://redisson.org/assets/logos/client7.png "Crimson Hexagon")](https://www.crimsonhexagon.com/)
[![Datorama](https://redisson.org/assets/logos/client8.png "Datorama")](https://datorama.com/)   
[![Invaluable](https://redisson.org/assets/logos/client13.png "Invaluable")](http://www.invaluable.com/)   
[![Ticketmaster](https://redisson.org/assets/logos/client14.png "Ticketmaster")](http://www.ticketmaster.com/)
[![PANDORA](https://redisson.org/assets/logos/client15.png "PANDORA")](http://www.pandora.com/)   
[![Ticketmaster](https://redisson.org/assets/logos/client14.png "Ticketmaster")](http://www.ticketmaster.com/)   
[![ContaAzul](https://redisson.org/assets/logos/client18.png "ContaAzul")](https://contaazul.com/)   
[![NAB](https://redisson.org/assets/logos/client11.png "NAB")](https://www.nab.com.au/)   
[![NAB](https://redisson.org/assets/logos/client11.png "NAB")](https://www.nab.com.au/)
[![Alibaba](https://redisson.org/assets/logos/client19.png "Alibaba")](http://www.alibaba-inc.com)   
[![Flipkart](https://redisson.org/assets/logos/client21.png "Flipkart")](https://www.flipkart.com/)   
[![BBK](https://redisson.org/assets/logos/client22.png "BBK")](http://www.gdbbk.com/)
[![SULAKE](https://redisson.org/assets/logos/client17.png "SULAKE")](http://www.sulake.com/)   

@ -167,7 +167,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>[1.4,)</version>
<version>[1.4,2.0.0)</version>
<scope>provided</scope>
</dependency>
</dependencies>

@ -271,7 +271,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>[1.4,)</version>
<version>[1.4,2.0.0)</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

@ -42,13 +42,17 @@ public class RedissonListMultimapCache<K, V> extends RedissonListMultimap<K, V>
RedissonListMultimapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor connectionManager, String name) {
super(connectionManager, name);
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
if (evictionScheduler != null) {
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
}
baseCache = new RedissonMultimapCache<K>(connectionManager, this, getTimeoutSetName(), prefix);
}
RedissonListMultimapCache(EvictionScheduler evictionScheduler, Codec codec, CommandAsyncExecutor connectionManager, String name) {
super(codec, connectionManager, name);
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
if (evictionScheduler != null) {
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
}
baseCache = new RedissonMultimapCache<K>(connectionManager, this, getTimeoutSetName(), prefix);
}

@ -237,7 +237,7 @@ public class RedissonMap<K, V> extends RedissonExpirable implements RMap<K, V> {
return options == null || options.getLoader() == null;
}
protected RFuture<Map<K, V>> getAllOperationAsync(Set<K> keys) {
public RFuture<Map<K, V>> getAllOperationAsync(Set<K> keys) {
List<Object> args = new ArrayList<Object>(keys.size() + 1);
args.add(getName());
encodeMapKeys(args, keys);
@ -624,7 +624,7 @@ public class RedissonMap<K, V> extends RedissonExpirable implements RMap<K, V> {
Collections.<Object>singletonList(getName(key)), encodeMapKey(key), encodeMapValue(value));
}
protected RFuture<V> getOperationAsync(K key) {
public RFuture<V> getOperationAsync(K key) {
return commandExecutor.readAsync(getName(key), codec, RedisCommands.HGET, getName(key), encodeMapKey(key));
}
@ -973,7 +973,7 @@ public class RedissonMap<K, V> extends RedissonExpirable implements RMap<K, V> {
return get(fastRemoveAsync(keys));
}
MapScanResult<ScanObjectEntry, ScanObjectEntry> scanIterator(String name, RedisClient client, long startPos, String pattern) {
public MapScanResult<ScanObjectEntry, ScanObjectEntry> scanIterator(String name, RedisClient client, long startPos, String pattern) {
if (pattern == null) {
RFuture<MapScanResult<ScanObjectEntry, ScanObjectEntry>> f
= commandExecutor.readAsync(client, name, new MapScanCodec(codec), RedisCommands.HSCAN, name, startPos);

@ -210,7 +210,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
}
@Override
protected RFuture<Map<K, V>> getAllOperationAsync(Set<K> keys) {
public RFuture<Map<K, V>> getAllOperationAsync(Set<K> keys) {
List<Object> args = new ArrayList<Object>(keys.size() + 1);
List<Object> plainKeys = new ArrayList<Object>(keys.size());
@ -448,7 +448,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
}
@Override
protected RFuture<V> getOperationAsync(K key) {
public RFuture<V> getOperationAsync(K key) {
return commandExecutor.evalWriteAsync(getName(key), codec, RedisCommands.EVAL_MAP_VALUE,
"local value = redis.call('hget', KEYS[1], ARGV[2]); "
+ "if value == false then "
@ -618,7 +618,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
}
@Override
public RFuture<V> addAndGetOperationAsync(K key, Number value) {
protected RFuture<V> addAndGetOperationAsync(K key, Number value) {
ByteBuf keyState = encodeMapKey(key);
return commandExecutor.evalWriteAsync(getName(key), StringCodec.INSTANCE,
new RedisCommand<Object>("EVAL", new NumberConvertor(value.getClass())),
@ -1100,7 +1100,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
@Override
public RFuture<V> removeOperationAsync(K key) {
protected RFuture<V> removeOperationAsync(K key) {
return commandExecutor.evalWriteAsync(getName(key), codec, RedisCommands.EVAL_MAP_VALUE,
"local value = redis.call('hget', KEYS[1], ARGV[2]); "
+ "if value == false then "
@ -1198,7 +1198,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
}
@Override
MapScanResult<ScanObjectEntry, ScanObjectEntry> scanIterator(String name, RedisClient client, long startPos, String pattern) {
public MapScanResult<ScanObjectEntry, ScanObjectEntry> scanIterator(String name, RedisClient client, long startPos, String pattern) {
return get(scanIteratorAsync(name, client, startPos, pattern));
}
@ -1635,7 +1635,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
}
@Override
public RFuture<Void> putAllOperationAsync(Map<? extends K, ? extends V> map) {
protected RFuture<Void> putAllOperationAsync(Map<? extends K, ? extends V> map) {
List<Object> params = new ArrayList<Object>(map.size()*2 + 1);
params.add(System.currentTimeMillis());
for (java.util.Map.Entry<? extends K, ? extends V> t : map.entrySet()) {

@ -56,14 +56,14 @@ public abstract class RedissonObject implements RObject {
return commandExecutor.await(future, timeout, timeoutUnit);
}
protected static String prefixName(String prefix, String name) {
public static String prefixName(String prefix, String name) {
if (name.contains("{")) {
return prefix + ":" + name;
}
return prefix + ":{" + name + "}";
}
protected static String suffixName(String name, String suffix) {
public static String suffixName(String name, String suffix) {
if (name.contains("{")) {
return name + ":" + suffix;
}
@ -194,7 +194,7 @@ public abstract class RedissonObject implements RObject {
}
}
protected ByteBuf encode(Object value) {
public ByteBuf encode(Object value) {
if (commandExecutor.isRedissonReferenceSupportEnabled()) {
RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
if (reference != null) {
@ -209,7 +209,7 @@ public abstract class RedissonObject implements RObject {
}
}
protected ByteBuf encodeMapKey(Object value) {
public ByteBuf encodeMapKey(Object value) {
if (commandExecutor.isRedissonReferenceSupportEnabled()) {
RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
if (reference != null) {
@ -224,7 +224,7 @@ public abstract class RedissonObject implements RObject {
}
}
protected ByteBuf encodeMapValue(Object value) {
public ByteBuf encodeMapValue(Object value) {
if (commandExecutor.isRedissonReferenceSupportEnabled()) {
RedissonReference reference = RedissonObjectFactory.toReference(commandExecutor.getConnectionManager().getCfg(), value);
if (reference != null) {

@ -41,13 +41,17 @@ public class RedissonSetMultimapCache<K, V> extends RedissonSetMultimap<K, V> im
RedissonSetMultimapCache(EvictionScheduler evictionScheduler, CommandAsyncExecutor connectionManager, String name) {
super(connectionManager, name);
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
if (evictionScheduler != null) {
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
}
baseCache = new RedissonMultimapCache<K>(connectionManager, this, getTimeoutSetName(), prefix);
}
RedissonSetMultimapCache(EvictionScheduler evictionScheduler, Codec codec, CommandAsyncExecutor connectionManager, String name) {
super(codec, connectionManager, name);
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
if (evictionScheduler != null) {
evictionScheduler.scheduleCleanMultimap(name, getTimeoutSetName());
}
baseCache = new RedissonMultimapCache<K>(connectionManager, this, getTimeoutSetName(), prefix);
}

@ -152,6 +152,7 @@ public class CommandAsyncService implements CommandAsyncExecutor {
l.await();
} catch (InterruptedException e) {
interrupted = true;
break;
}
}
@ -524,6 +525,12 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
if (details.getConnectionFuture().cancel(false)) {
if (details.getException() == null) {
details.setException(new RedisTimeoutException("Unable to get connection! "
+ "Node source: " + source
+ ", command: " + command + ", command params: " + LogHelper.toString(details.getParams())
+ " after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts"));
}
connectionManager.getShutdownLatch().release();
} else {
if (details.getConnectionFuture().isSuccess()) {
@ -531,7 +538,10 @@ public class CommandAsyncService implements CommandAsyncExecutor {
if (details.getAttempt() == connectionManager.getConfig().getRetryAttempts()) {
if (details.getWriteFuture() != null && details.getWriteFuture().cancel(false)) {
if (details.getException() == null) {
details.setException(new RedisTimeoutException("Unable to send command: " + command + " with params: " + LogHelper.toString(details.getParams()) + " after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts"));
details.setException(new RedisTimeoutException("Unable to send command! "
+ "Node source: " + source + ", connection: " + details.getConnectionFuture().getNow().getChannel()
+ ", command: " + command + ", command params: " + LogHelper.toString(details.getParams())
+ " after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts"));
}
details.getAttemptPromise().tryFailure(details.getException());
}
@ -559,7 +569,9 @@ public class CommandAsyncService implements CommandAsyncExecutor {
if (details.getAttempt() == connectionManager.getConfig().getRetryAttempts()) {
if (details.getException() == null) {
details.setException(new RedisTimeoutException("Unable to send command: " + command + " with params: " + LogHelper.toString(details.getParams()) + " after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts"));
details.setException(new RedisTimeoutException("Unable to send command! Node source: " + source
+ ", command: " + command + ", command params: " + LogHelper.toString(details.getParams())
+ " after " + connectionManager.getConfig().getRetryAttempts() + " retry attempts"));
}
details.getAttemptPromise().tryFailure(details.getException());
return;
@ -658,11 +670,13 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
if (!future.isSuccess()) {
log.trace("Can't write {} to {}", details.getCommand(), connection);
details.setException(new WriteRedisConnectionException(
"Can't write command: " + details.getCommand() + ", params: " + LogHelper.toString(details.getParams()) + " to channel: " + future.channel(), future.cause()));
"Unable to send command! Node source: " + details.getSource() + ", connection: " + future.channel() +
", command: " + details.getCommand() + ", params: " + LogHelper.toString(details.getParams()), future.cause()));
if (details.getAttempt() == connectionManager.getConfig().getRetryAttempts()) {
details.getAttemptPromise().tryFailure(details.getException());
if (!details.getAttemptPromise().tryFailure(details.getException())) {
log.error(details.getException().getMessage());
}
}
return;
}

Loading…
Cancel
Save