本文整理汇总了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;
}
示例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();
}
}
示例3: releaseChannel
import com.jcraft.jsch.ChannelSftp; //导入方法依赖的package包/类
private void releaseChannel(ChannelSftp channel) {
synchronized (channelLock) {
if (channel.isConnected()) {
spareChannels.push(channel);
}
decrementStatistics();
}
}
示例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);
}
}
}
示例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;
}
示例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;
}