pu2925 opened a new issue, #270:
URL: https://github.com/apache/mina-sshd/issues/270

   We 
   
   We are creating a session like 
    ClientSession session = 
(ClientSession)((ConnectFuture)client.connect(loginUserName, hostName, 
22).verify(2L, TimeUnit.SECONDS)).getSession();
   ...
   session.addPublicKeyIdentity(keys.iterator().next());
   ..
    session.auth().verify(120000L, TimeUnit.MILLISECONDS);
   
   After doing a PUT File operation ( Method like below ) and doing the session 
close like  sshSession.close();
   
   We see Threads like sshd-SshClient[3c0574ec]-nio2-thread-17 not getting 
released.  
     
   
   
   
   **Put File method**
   public static void putFile(ClientSession session, String srcPath, String 
destPathForPut) throws SSHConnectionException {
       try(SftpClient sftpClient = 
DefaultSftpClientFactory.INSTANCE.createSftpClient(session); 
           OutputStream o = sftpClient.write(destPathForPut, new 
SftpClient.OpenMode[] { SftpClient.OpenMode.Create, SftpClient.OpenMode.Write, 
SftpClient.OpenMode.Truncate }); BufferedOutputStream os = new 
BufferedOutputStream(o)) {
         File sourceFile = new File(srcPath);
         Files.copy(sourceFile.toPath(), os);
       } catch (IOException e) {
         s_log.log(Level.SEVERE, "Failed to store content via sftp at " + 
destPathForPut + " on host due to " + e
             .getMessage(), e);
         throw new SSHConnectionException("Failed to store content via sftp at 
" + destPathForPut + " on host due to " + e
             
             .getMessage(), e);
       } 
     }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to