various code improvements to reduce compiler warnings

This commit is contained in:
Costin Leau
2012-06-27 12:58:54 +03:00
parent 7656fd3160
commit fcec09dfcf
12 changed files with 6 additions and 45 deletions

View File

@@ -234,7 +234,6 @@ public class JedisConnection implements RedisConnection {
}
}
@SuppressWarnings("unchecked")
public List<Object> closePipeline() {
if (pipeline != null) {
List<Object> execute = pipeline.syncAndReturnAll();

View File

@@ -140,7 +140,6 @@ public class RjcConnection implements RedisConnection {
}
}
@SuppressWarnings("unchecked")
public List<Object> closePipeline() {
if (pipeline != null) {
try {

View File

@@ -26,7 +26,6 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.util.Assert;
/**
@@ -36,7 +35,7 @@ import org.springframework.util.Assert;
*/
public class RjcConnectionFactory implements InitializingBean, DisposableBean, RedisConnectionFactory {
private final static Log log = LogFactory.getLog(JedisConnectionFactory.class);
private final static Log log = LogFactory.getLog(RjcConnectionFactory.class);
private String hostName = "localhost";
private int port = Protocol.DEFAULT_PORT;

View File

@@ -173,7 +173,7 @@ public class SrpConnection implements RedisConnection {
public List<Object> closePipeline() {
if (pipeline != null) {
List<Object> execute = new ArrayList(callback.complete());
List<Object> execute = new ArrayList<Object>(callback.complete());
callback.close();
callback = null;
if (execute != null && !execute.isEmpty()) {

View File

@@ -19,14 +19,11 @@ package org.springframework.data.redis.connection.srp;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
/**
* Connection factory creating <a href="http://github.com/spullara/redis-protocol">Redis Protocol</a> based connections.
@@ -35,8 +32,6 @@ import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
*/
public class SrpConnectionFactory implements InitializingBean, DisposableBean, RedisConnectionFactory {
private final static Log log = LogFactory.getLog(JedisConnectionFactory.class);
private String hostName = "localhost";
private int port = 6379;
private BlockingQueue<SrpConnection> trackedConnections = new ArrayBlockingQueue<SrpConnection>(50);

View File

@@ -118,8 +118,6 @@ class DefaultListOperations<K, V> extends AbstractOperations<K, V> implements Li
public List<V> range(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<List<V>>() {
@SuppressWarnings("unchecked")
public List<V> doInRedis(RedisConnection connection) {
return deserializeValues(connection.lRange(rawKey, start, end));
}

View File

@@ -200,8 +200,6 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
return union(key, Collections.singleton(otherKey));
}
@SuppressWarnings("unchecked")
public Set<V> union(K key, Collection<K> otherKeys) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {

View File

@@ -20,7 +20,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.transaction.support.ResourceHolder;
import org.springframework.transaction.support.ResourceHolderSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
@@ -136,28 +135,6 @@ public abstract class RedisConnectionUtils {
return (connHolder != null && conn == connHolder.getConnection());
}
private static class RedisConnectionSynchronization extends
ResourceHolderSynchronization<RedisConnectionHolder, RedisConnectionFactory> {
private final boolean newRedisConnection;
public RedisConnectionSynchronization(RedisConnectionHolder connHolder, RedisConnectionFactory connFactory,
boolean newRedisConnection) {
super(connHolder, connFactory);
this.newRedisConnection = newRedisConnection;
}
protected boolean shouldUnbindAtCompletion() {
return this.newRedisConnection;
}
protected void releaseResource(RedisConnectionHolder resourceHolder, RedisConnectionFactory resourceKey) {
releaseConnection(resourceHolder.getConnection(), resourceKey);
}
}
private static class RedisConnectionHolder implements ResourceHolder {
private boolean isVoid = false;

View File

@@ -23,7 +23,7 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.ConversionServiceFactory;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.util.Assert;
/**
@@ -41,7 +41,7 @@ import org.springframework.util.Assert;
public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFactoryAware {
private final Charset charset;
private Converter converter = new Converter(ConversionServiceFactory.createDefaultConversionService());
private Converter converter = new Converter(new DefaultConversionService());
private Class<T> type;
public GenericToStringSerializer(Class<T> type) {
@@ -108,7 +108,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
this.typeConverter = typeConverter;
}
<T> T convert(Object value, Class<T> targetType) {
<E> E convert(Object value, Class<E> targetType) {
if (conversionService != null) {
return conversionService.convert(value, targetType);
}

View File

@@ -31,8 +31,6 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
private Converter<Object, byte[]> serializer = new SerializingConverter();
private Converter<byte[], Object> deserializer = new DeserializingConverter();
@SuppressWarnings("unchecked")
public Object deserialize(byte[] bytes) {
if (SerializationUtils.isEmpty(bytes)) {
return null;

View File

@@ -47,8 +47,6 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
private volatile boolean capped = false;
private volatile long defaultWait = 0;
private class DefaultRedisListIterator extends RedisIterator<E> {
public DefaultRedisListIterator(Iterator<E> delegate) {

View File

@@ -23,9 +23,9 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import org.springframework.data.redis.connection.DataType;