DATAREDIS-505 - Polishing.

Extend date range in license header. Retrieve connection and config for possible reconfiguration only if keyspaceNotificationsConfigParameter has a value.

Original pull request: #202.
This commit is contained in:
Mark Paluch
2016-06-17 13:07:13 +02:00
parent 65c7b2c23e
commit 74a5652ff0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,17 +75,22 @@ public abstract class KeyspaceEventMessageListener implements MessageListener, I
*/
public void init() {
RedisConnection connection = listenerContainer.getConnectionFactory().getConnection();
List<String> config = connection.getConfig("notify-keyspace-events");
if (StringUtils.hasText(keyspaceNotificationsConfigParameter)) {
if (config.size() == 2) {
if (!StringUtils.hasText(config.get(1))) {
RedisConnection connection = listenerContainer.getConnectionFactory().getConnection();
try {
List<String> config = connection.getConfig("notify-keyspace-events");
if (config.size() == 2 && !StringUtils.hasText(config.get(1))) {
connection.setConfig("notify-keyspace-events", keyspaceNotificationsConfigParameter);
}
} finally {
connection.close();
}
}
connection.close();
doRegister(listenerContainer);
}