Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-1089

Provide Closeable wrapper for sub-interfaces that use a one-time session

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.5.1
    • 2.6.0
    • None

    Description

      The current code requires closing the session separately from any "sub-interface" that use it - e.g.:

      try (ClientSession session = ...obtain a session...;
            SftpClient sftp = ...obtain client(session)...) {
         ... use SFTP client ...
      }
      

      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.;

      // 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);
      }
      

      Attachments

        Issue Links

          Activity

            People

              lgoldstein Lyor Goldstein
              lgoldstein Lyor Goldstein
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m