DATAKV-22
+ rename RedisListenerContainer to RedisMessageListenerContainer + fix eager initialization of the container when calling the setter
This commit is contained in:
@@ -56,14 +56,14 @@ import org.springframework.util.CollectionUtils;
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class RedisListenerContainer implements InitializingBean, DisposableBean, BeanNameAware, SmartLifecycle {
|
||||
public class RedisMessageListenerContainer implements InitializingBean, DisposableBean, BeanNameAware, SmartLifecycle {
|
||||
|
||||
private static final Log log = LogFactory.getLog(RedisListenerContainer.class);
|
||||
private static final Log log = LogFactory.getLog(RedisMessageListenerContainer.class);
|
||||
|
||||
/**
|
||||
* Default thread name prefix: "RedisListeningContainer-".
|
||||
*/
|
||||
public static final String DEFAULT_THREAD_NAME_PREFIX = ClassUtils.getShortName(RedisListenerContainer.class) + "-";
|
||||
public static final String DEFAULT_THREAD_NAME_PREFIX = ClassUtils.getShortName(RedisMessageListenerContainer.class) + "-";
|
||||
|
||||
|
||||
private Executor subscriptionExecutor;
|
||||
@@ -172,7 +172,7 @@ public class RedisListenerContainer implements InitializingBean, DisposableBean,
|
||||
running = true;
|
||||
lazyListen();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Started RedisListenerContainer");
|
||||
log.debug("Started RedisMessageListenerContainer");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class RedisListenerContainer implements InitializingBean, DisposableBean,
|
||||
subscriptionTask.cancel();
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Stopped RedisListenerContainer");
|
||||
log.debug("Stopped RedisMessageListenerContainer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,9 +370,6 @@ public class RedisListenerContainer implements InitializingBean, DisposableBean,
|
||||
subscriptionTask.subscribeChannel(channels.toArray(new byte[channels.size()][]));
|
||||
subscriptionTask.subscribePattern(patterns.toArray(new byte[patterns.size()][]));
|
||||
}
|
||||
else {
|
||||
lazyListen();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +60,8 @@ import org.springframework.util.ObjectUtils;
|
||||
* }</pre>
|
||||
*
|
||||
* For further examples and discussion please do refer to the Spring Data
|
||||
* reference documentation which describes this class (and it's attendant
|
||||
* XML configuration) in detail.
|
||||
* reference documentation which describes this class (and its attendant
|
||||
* configuration) in detail.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Costin Leau
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PubSubTests<T> {
|
||||
|
||||
private static final String CHANNEL = "pubsub::test";
|
||||
|
||||
protected RedisListenerContainer container;
|
||||
protected RedisMessageListenerContainer container;
|
||||
protected ObjectFactory<T> factory;
|
||||
protected RedisTemplate template;
|
||||
private static Set<RedisConnectionFactory> connFactories = new LinkedHashSet<RedisConnectionFactory>();
|
||||
@@ -68,7 +68,7 @@ public class PubSubTests<T> {
|
||||
public void setUp() throws Exception {
|
||||
adapter.setSerializer(template.getValueSerializer());
|
||||
|
||||
container = new RedisListenerContainer();
|
||||
container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(template.getConnectionFactory());
|
||||
container.setBeanName("container");
|
||||
container.afterPropertiesSet();
|
||||
|
||||
Reference in New Issue
Block a user