Skip to content

Introduce Predicate<T extends StatefulConnection> to ConnectionPoolSupport to customize pooled connection validation #3081

@mp911de

Description

@mp911de

Feature Request

Is your feature request related to a problem? Please describe

It would be good to customize how pooled connections are validated. Out of the discussion at spring-projects/spring-data-redis#3067 (comment) (which boils down to defunct connections that end up with timeouts as the remote peer isn't responsive) it would be neat to customize the connection validation. Right now, RedisPooledObjectFactory.validateObject(…) performs isOpen validation.

Describe the solution you'd like

By accepting a functional interface returning a boolean flag, it would be possible that callers provide their own validation function. Having another overload of ConnectionPoolSupport.createGenericObjectPool(…) could accept either a Predicate or, better an argument object that encapsulates Predicate isValid and boolean wrapConnections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions