Fix CachedSessionFactory Race

Close the pool so that any sessions returned after the factory is
`destroy()`ed are closed.

* Call `removeAllIdleItems()` in `close()`.

* Close sessions in `SftpStreamingMessageSourceTests`.

**cherry-pick to all supported branches**
This commit is contained in:
Gary Russell
2020-07-08 14:19:57 -04:00
committed by GitHub
parent 0f7f0845f4
commit b45d690a45
6 changed files with 53 additions and 7 deletions

View File

@@ -137,7 +137,7 @@ public class CachingSessionFactory<F> implements SessionFactory<F>, DisposableBe
*/
@Override
public void destroy() {
this.pool.removeAllIdleItems();
this.pool.close();
}
/**