GH-3271: Close session on error in stream source
Fixes https://github.com/spring-projects/spring-integration/issues/3271 When exception happens at `.withPayload(session.readRaw(remotePath))` in the `AbstractRemoteFileStreamingMessageSource` we don't close session. The resource leaking happens in the caching session factory * Add `session.close();` into the `catch (IOException e) {` in the `AbstractRemoteFileStreamingMessageSource.doReceive()` to clean up resources properly **Cherry-pick to 5.2.x, 5.1.x & 4.3.x**
This commit is contained in:
committed by
Gary Russell
parent
f047f0528b
commit
d71fb2e5da
@@ -216,6 +216,7 @@ public abstract class AbstractRemoteFileStreamingMessageSource<F>
|
||||
this.fileInfoJson ? file.toJson() : file);
|
||||
}
|
||||
catch (IOException e) {
|
||||
session.close();
|
||||
throw new UncheckedIOException("IOException when retrieving " + remotePath, e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user