You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2020/09/26 06:54:00 UTC
[jira] [Created] (SSHD-1089) Provide Closeable wrapper for
sub-interfaces that use a one-time session
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: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org