Lyor Goldstein created SSHD-1089:
------------------------------------
Summary: Provide Closeable wrapper for sub-interfaces that use a
one-time session
Key: SSHD-1089
URL: https://issues.apache.org/jira/browse/SSHD-1089
Project: MINA SSHD
Issue Type: Improvement
Affects Versions: 2.5.1
Reporter: Lyor Goldstein
Assignee: Lyor Goldstein
The current code requires closing the session separately from any
"sub-interface" that use it - e.g.:
{code:java}
try (ClientSession session = ...obtain a session...;
SftpClient sftp = ...obtain client(session)...) {
... use SFTP client ...
}
{code}
In some cases we may want to expose only the "sub-interface" and have it
automatically close the underlying session when the "sub-interface" is closed.
E.g.;
{code:java}
// The session is also closed when SFTP client is closed
try (SftpClient sftp = createSftpClient(...)) {
... use SFTP client ...
}
SftpClient createSftpClient(....) {
ClientSession session = ...obtain a session...;
SftpClient sftp = ...obtain client(session)...;
return wrapAsCloseable(sftp, session);
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]