Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RedisKeyValueAdapter.destroy calls RedisConnectionFactory.destroy [DATAREDIS-507] #1083

Closed
spring-projects-issues opened this issue May 3, 2016 · 0 comments
Assignees
Labels
type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 3, 2016

Mark Paluch opened DATAREDIS-507 and commented

The RedisKeyValueAdapter creates an exception during shutdown:

2016-05-03 12:07:02.343  WARN 94337 --- [       Thread-6] o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method failed on bean with name 'redisKeyValueAdapter': com.lambdaworks.redis.RedisException: Connection is closed

This is because RedisKeyValueAdapter closes the connection factory before the message listener containers are shut down:

	public void destroy() throws Exception {

		if (redisOps instanceof RedisTemplate) {
			RedisConnectionFactory connectionFactory = ((RedisTemplate<?, ?>) redisOps).getConnectionFactory();
			if (connectionFactory instanceof DisposableBean) {
				((DisposableBean) connectionFactory).destroy();
			}
		}

		this.expirationListener.destroy();
		this.messageListenerContainer.destroy();
	}

Closing the RedisConnectionFactory seems not necessary as the bean is managed by the container itself


Reference URL: https://github.com/spring-projects/spring-data-redis/blob/master/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java#L450

Referenced from: pull request #195

Backported to: 1.7.2 (Hopper SR2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug
Projects
None yet
Development

No branches or pull requests

2 participants