Package com.jcraft.jsch

Examples of com.jcraft.jsch.Session.disconnect()


            } else {
                log("Caught exception: " + e.getMessage(), Project.MSG_ERR);
            }
        } finally {
            if (session != null && session.isConnected()) {
                session.disconnect();
            }
        }
    }

    public LocalTunnel createLocalTunnel() {
View Full Code Here


        }
        if (oldSession != null && !oldSession.equals(newSession) && oldSession.isConnected()) {
            entry.releaseChannelSftp();
            String oldhost = oldSession.getHost();
            Message.verbose(":: SSH :: closing ssh connection from " + oldhost + "...");
            oldSession.disconnect();
            Message.verbose(":: SSH :: ssh connection closed from " + oldhost);
        }
        if ((newSession == null) && (entry != null)) {
            uriCacheMap.remove(createCacheKey(user, host, port));
            if (entry.getSession() != null) {
View Full Code Here

        }
        if (oldSession != null && !oldSession.equals(newSession) && oldSession.isConnected()) {
            entry.releaseChannelSftp();
            String oldhost = oldSession.getHost();
            Message.verbose(":: SSH :: closing ssh connection from " + oldhost + "...");
            oldSession.disconnect();
            Message.verbose(":: SSH :: ssh connection closed from " + oldhost);
        }
        if ((newSession == null) && (entry != null)) {
            uriCacheMap.remove(createCacheKey(user, host, port));
            if (entry.getSession() != null) {
View Full Code Here

      return doFence(session, serviceAddr);
    } catch (JSchException e) {
      LOG.warn("Unable to achieve fencing on remote host", e);
      return false;
    } finally {
      session.disconnect();
    }
  }


  private Session createSession(String host, Args args) throws JSchException {
View Full Code Here

      return doFence(session, serviceAddr);
    } catch (JSchException e) {
      LOG.warn("Unable to achieve fencing on remote host", e);
      return false;
    } finally {
      session.disconnect();
    }
  }


  private Session createSession(String host, Args args) throws JSchException {
View Full Code Here

            FileOutputStream tempFileOutputStream =
                    new FileOutputStream(downloadFile);

            IOUtils.copy(c.get(filePath), tempFileOutputStream);
            channel.disconnect();
            session.disconnect();

            return downloadFile;
        } catch (Exception e) {
            final String msg = "Error downloading namespace";
            throw new ResourceDownloadError(url, msg, e);
View Full Code Here

    logger.info("exec exit status: " + status);

    channel.disconnect();

    session.disconnect();

    return status;

  }
View Full Code Here

    channel.disconnect();

    final int status = channel.getExitStatus();

    session.disconnect();

    logger.info("sftp exit status: " + status);

    return status;
View Full Code Here

      while (!session.isConnected() && retries < 3) {
        try {
          retries++;
          session.connect(tms);
        } catch (JSchException e) {
          session.disconnect();
          session = null;
          // if authentication failed maybe credentials changed at the
          // remote end therefore reset credentials and retry
          if (credentialsProvider != null && e.getCause() == null
              && e.getMessage().equals("Auth fail")
View Full Code Here

      } finally {
         if (channel != null && channel.isConnected()) {
            channel.disconnect();
         }
         if (session != null && session.isConnected()) {
            session.disconnect();
         }
         if (in != null) {
            try {
               in.close();
            } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.