We have an application that is using SingleConnectionDataSource to connect to an external db. In production, sometimes, the remote db stops responding which causes our connections to block on the read indefinitely.

Is there a way to force the termination of the read and close the connection after x amount of time? We currently have tried an implementation using Future to set a timeout but the problem is that the connection is still blocking and can't be closed until the read actually completes.