本文整理汇总了Java中org.apache.sshd.common.future.CloseFuture类的典型用法代码示例。如果您正苦于以下问题:Java CloseFuture类的具体用法?Java CloseFuture怎么用?Java CloseFuture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseFuture类属于org.apache.sshd.common.future包,在下文中一共展示了CloseFuture类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCloseGracefully
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
context.
writeAndFlush(Unpooled.EMPTY_BUFFER).
addListener(ChannelFutureListener.CLOSE).
addListener(fut -> {
closeFuture.setClosed();
});
return closeFuture;
}
示例2: doCloseGracefully
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
if (closeEventLoopGroup) {
eventLoopGroup.shutdownGracefully().addListener((Future<Object> fut) -> {
closeFuture.setClosed();
});
} else {
closeFuture.setClosed();
}
return closeFuture;
}
示例3: run
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected void run() throws Failure {
IoAcceptor acceptor = sshDaemon.getIoAcceptor();
if (acceptor == null) {
throw new Failure(1, "fatal: sshd no longer running");
}
for (String sessionId : sessionIds) {
boolean connectionFound = false;
int id = (int) Long.parseLong(sessionId, 16);
for (IoSession io : acceptor.getManagedSessions().values()) {
AbstractSession serverSession = AbstractSession.getSession(io, true);
SshSession sshSession =
serverSession != null ? serverSession.getAttribute(SshSession.KEY) : null;
if (sshSession != null && sshSession.getSessionId() == id) {
connectionFound = true;
stdout.println("closing connection " + sessionId + "...");
CloseFuture future = io.close(true);
if (wait) {
try {
future.await();
stdout.println("closed connection " + sessionId);
} catch (IOException e) {
log.warn("Wait for connection to close interrupted: " + e.getMessage());
}
}
break;
}
}
if (!connectionFound) {
stderr.print("close connection " + sessionId + ": no such connection\n");
}
}
}
示例4: doCloseGracefully
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
context.
writeAndFlush(Unpooled.EMPTY_BUFFER).
addListener(ChannelFutureListener.CLOSE).
addListener(fut -> {
closeFuture.setClosed();
});
return closeFuture;
}
示例5: close
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public void close() throws IOException {
out.close(false).addListener(new SshFutureListener<CloseFuture>() {
@SuppressWarnings("synthetic-access")
@Override
public void operationComplete(CloseFuture future) {
callback.onExit(0);
}
});
}
示例6: close
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public CloseFuture close(boolean immediately) {
return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
@Override
public void operationComplete(CloseFuture sshFuture) {
closeImmediately0();
}
});
}
示例7: close
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public CloseFuture close(boolean immediately) {
return super.close(immediately).addListener(new SshFutureListener<CloseFuture>() {
@Override
public void operationComplete(CloseFuture sshFuture) {
executor.execute(new Runnable() {
@Override
public void run() {
getConnector().dispose();
}
});
}
});
}
示例8: doCloseGracefully
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
channelGroup.close().addListener(fut -> closeFuture.setClosed());
return closeFuture;
}
示例9: close
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public CloseFuture close(boolean immediately) {
factory.close(immediately);
return super.close(immediately);
}
示例10: doCloseGracefully
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
channelGroup.close().addListener(fut -> closeFuture.setClosed());
return closeFuture;
}
示例11: addCloseFutureListener
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public void addCloseFutureListener(SshFutureListener<CloseFuture> listener) {
throw new RuntimeException("Not implemented");
}
示例12: removeCloseFutureListener
import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener) {
throw new RuntimeException("Not implemented");
}