當前位置: 首頁>>代碼示例>>Java>>正文


Java ChannelSftp.isConnected方法代碼示例

本文整理匯總了Java中com.jcraft.jsch.ChannelSftp.isConnected方法的典型用法代碼示例。如果您正苦於以下問題:Java ChannelSftp.isConnected方法的具體用法?Java ChannelSftp.isConnected怎麽用?Java ChannelSftp.isConnected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jcraft.jsch.ChannelSftp的用法示例。


在下文中一共展示了ChannelSftp.isConnected方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SFTPInputStream

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
SFTPInputStream(InputStream stream, ChannelSftp channel,
    FileSystem.Statistics stats) {

  if (stream == null) {
    throw new IllegalArgumentException(E_NULL_INPUTSTREAM);
  }
  if (channel == null || !channel.isConnected()) {
    throw new IllegalArgumentException(E_CLIENT_NULL);
  }
  this.wrappedStream = stream;
  this.channel = channel;
  this.stats = stats;

  this.pos = 0;
  this.closed = false;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:17,代碼來源:SFTPInputStream.java

示例2: putChannel

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
/**
 * Returns a channel to the pool.
 */
protected void putChannel(final ChannelSftp channel)
{
    if (idleChannel == null)
    {
        // put back the channel only if it is still connected
        if (channel.isConnected() && !channel.isClosed())
        {
            idleChannel = channel;
        }
    }
    else
    {
        channel.disconnect();
    }
}
 
開發者ID:wso2,項目名稱:wso2-commons-vfs,代碼行數:19,代碼來源:SftpFileSystem.java

示例3: releaseChannel

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
private void releaseChannel(ChannelSftp channel) {
    synchronized (channelLock) {
        if (channel.isConnected()) {
            spareChannels.push(channel);
        }
        decrementStatistics();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:SftpSupport.java

示例4: disconnect

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
void disconnect(ChannelSftp channel) throws IOException {
  if (channel != null) {
    // close connection if too many active connections
    boolean closeConnection = false;
    synchronized (this) {
      if (liveConnectionCount > maxConnection) {
        --liveConnectionCount;
        con2infoMap.remove(channel);
        closeConnection = true;
      }
    }
    if (closeConnection) {
      if (channel.isConnected()) {
        try {
          Session session = channel.getSession();
          channel.disconnect();
          session.disconnect();
        } catch (JSchException e) {
          throw new IOException(StringUtils.stringifyException(e));
        }
      }

    } else {
      returnToPool(channel);
    }
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:28,代碼來源:SFTPConnectionPool.java

示例5: getChannelSftp

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
/**
 * retrieves an sftp channel from the cache
 *
 * @param session
 *            to connect to
 * @return channelSftp or null if not successful (channel not existent or dead)
 * @throws IOException should never happen
 */
public ChannelSftp getChannelSftp(Session session) throws IOException {
    ChannelSftp channel = null;
    Entry entry = getCacheEntry(session);
    if (entry != null) {
        channel = entry.getChannelSftp();
        if (channel != null && !channel.isConnected()) {
            entry.releaseChannelSftp();
            channel = null;
        }
    }
    return channel;
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:21,代碼來源:SshCache.java

示例6: channel

import com.jcraft.jsch.ChannelSftp; //導入方法依賴的package包/類
ChannelSftp channel() throws JSchException {
    ChannelSftp ch = current.get();
    if (null == ch || !ch.isConnected()) {
        ch = newChannel();
        current.set(ch);
    }
    return ch;
}
 
開發者ID:osglworks,項目名稱:java-sftp,代碼行數:9,代碼來源:Sftp.java


注:本文中的com.jcraft.jsch.ChannelSftp.isConnected方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。