public static boolean saveSshSessionAndChannel ( Session session , Channel channel , GlobalSessionObject < Map < String , SSHConnection > > sessionParam , String sessionId ) { final SSHConnection sshConnection ; if ( channel != null ) { sshConnection = new SSHConnection ( session , channel ) ; } else { sshConnection = new SSHConnection ( session ) ; } if ( sessionParam != null ) { Map < String , SSHConnection > tempMap = sessionParam . get ( ) ; if ( tempMap == null ) { tempMap = new HashMap <> ( ) ; } tempMap . put ( sessionId , sshConnection ) ; sessionParam . setResource ( new SSHSessionResource ( tempMap ) ) ; return true ; } return false ; }
Save the SSH session and the channel in the cache .