当前位置: 首页>>代码示例>>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;未经允许,请勿转载。