Merge branch 'master' into 3.0.0

# Conflicts:
#	pom.xml
pull/1821/head
Nikita Koksharov 6 years ago
commit 7ec852564e

@ -221,14 +221,7 @@ public abstract class AbstractCacheMap<K, V> implements Cache<K, V> {
protected abstract void onMapFull();
boolean isFull() {
if (size == 0) {
return false;
}
return map.size() >= size;
}
private boolean isFull(K key) {
protected boolean isFull(K key) {
if (size == 0) {
return false;
}

@ -0,0 +1,27 @@
/**
* Copyright 2018 Nikita Koksharov
*
* 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.cache;
/**
*
* @author Nikita Koksharov
*
*/
public interface CachedValueReference {
CachedValue<?, ?> getOwner();
}

@ -24,7 +24,7 @@ import java.lang.ref.SoftReference;
*
* @param <V> value type
*/
public class CachedValueSoftReference<V> extends SoftReference<V> {
public class CachedValueSoftReference<V> extends SoftReference<V> implements CachedValueReference {
private final CachedValue<?, ?> owner;
@ -33,6 +33,7 @@ public class CachedValueSoftReference<V> extends SoftReference<V> {
this.owner = owner;
}
@Override
public CachedValue<?, ?> getOwner() {
return owner;
}

@ -24,7 +24,7 @@ import java.lang.ref.WeakReference;
*
* @param <V> value type
*/
public class CachedValueWeakReference<V> extends WeakReference<V> {
public class CachedValueWeakReference<V> extends WeakReference<V> implements CachedValueReference {
private final CachedValue<?, ?> owner;
@ -33,6 +33,7 @@ public class CachedValueWeakReference<V> extends WeakReference<V> {
this.owner = owner;
}
@Override
public CachedValue<?, ?> getOwner() {
return owner;
}

@ -45,14 +45,20 @@ public class ReferenceCacheMap<K, V> extends AbstractCacheMap<K, V> {
this.type = type;
}
@Override
protected CachedValue<K, V> create(K key, V value, long ttl, long maxIdleTime) {
return new ReferenceCachedValue<K, V>(key, value, ttl, maxIdleTime, queue, type);
}
@Override
protected boolean isFull(K key) {
return true;
}
@Override
protected boolean removeExpiredEntries() {
while (true) {
CachedValueSoftReference<V> value = (CachedValueSoftReference<V>) queue.poll();
CachedValueReference value = (CachedValueReference) queue.poll();
if (value == null) {
break;
}

@ -17,6 +17,7 @@ package org.redisson.client.handler;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
@ -155,7 +156,13 @@ public class RedisChannelInitializer extends ChannelInitializer<Channel> {
SSLParameters sslParams = new SSLParameters();
if (config.isSslEnableEndpointIdentification()) {
sslParams.setEndpointIdentificationAlgorithm("HTTPS");
// TODO remove for JDK 1.7+
try {
Method method = sslParams.getClass().getDeclaredMethod("setEndpointIdentificationAlgorithm", String.class);
method.invoke(sslParams, "HTTPS");
} catch (Exception e) {
throw new SSLException(e);
}
} else {
if (config.getSslTruststore() == null) {
sslContextBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE);

@ -45,7 +45,7 @@ public class PendingResultDecoder implements MultiDecoder<Object> {
for (List<String> mapping : customerParts) {
consumerNames.put(mapping.get(0), Long.valueOf(mapping.get(1)));
}
return new PendingResult((long)parts.get(0), convertor.convert(parts.get(1)), convertor.convert(parts.get(2)), consumerNames);
return new PendingResult((Long)parts.get(0), convertor.convert(parts.get(1)), convertor.convert(parts.get(2)), consumerNames);
}
}

Loading…
Cancel
Save