Skip to content

LettuceConnectionFactory.destroy() should release reactiveConnectionProvider resources [DATAREDIS-1027] #1598

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

Closed
spring-projects-issues opened this issue Aug 15, 2019 · 1 comment
Assignees
Labels
in: lettuce Lettuce driver type: bug A general bug

Comments

@spring-projects-issues
Copy link

Kevin Qian opened DATAREDIS-1027 and commented

// code placeholder
public void destroy() {

   resetConnection();

   if (connectionProvider instanceof DisposableBean) {
      try {
         ((DisposableBean) connectionProvider).destroy();
      } catch (Exception e) {

         if (log.isWarnEnabled()) {
            log.warn(connectionProvider + " did not shut down gracefully.", e);
         }
      }
   }

   try {
      Duration timeout = clientConfiguration.getShutdownTimeout();
      client.shutdown(timeout.toMillis(), timeout.toMillis(), TimeUnit.MILLISECONDS);
   } catch (Exception e) {

      if (log.isWarnEnabled()) {
         log.warn((client != null ? ClassUtils.getShortName(client.getClass()) : "LettuceClient")
               + " did not shut down gracefully.", e);
      }
   }

   if (clusterCommandExecutor != null) {

      try {
         clusterCommandExecutor.destroy();
      } catch (Exception ex) {
         log.warn("Cannot properly close cluster command executor", ex);
      }
   }
}

should we need to invoke destroy method of reactiveConnectionProvider object to release resources?


Referenced from: pull request #470

Backported to: 2.1.11 (Lovelace SR11)

@spring-projects-issues
Copy link
Author

Mark Paluch commented

Good catch. It makes sense to dispose the reactive connection provider to release a backing connection pool

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

No branches or pull requests

2 participants