当前位置: 首页>>代码示例>>Java>>正文


Java CloseFuture类代码示例

本文整理汇总了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;
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:11,代码来源:NettyIoSession.java

示例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;
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:12,代码来源:NettyIoServiceFactory.java

示例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");
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:34,代码来源:CloseConnection.java

示例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;
}
 
开发者ID:termd,项目名称:termd,代码行数:11,代码来源:NettyIoSession.java

示例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);
        }
    });
}
 
开发者ID:termd,项目名称:termd,代码行数:11,代码来源:AsyncEchoShellFactory.java

示例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();
        }
    });
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:10,代码来源:TcpipServerChannel.java

示例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();
                }
            });
        }
    });
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:15,代码来源:EofClosingTcpipServerChannel.java

示例8: doCloseGracefully

import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
    channelGroup.close().addListener(fut -> closeFuture.setClosed());
    return closeFuture;
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:6,代码来源:NettyIoAcceptor.java

示例9: close

import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public CloseFuture close(boolean immediately) {
  factory.close(immediately);
  return super.close(immediately);
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:6,代码来源:TestServiceFactory.java

示例10: doCloseGracefully

import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
protected CloseFuture doCloseGracefully() {
  channelGroup.close().addListener(fut -> closeFuture.setClosed());
  return closeFuture;
}
 
开发者ID:termd,项目名称:termd,代码行数:6,代码来源:NettyIoAcceptor.java

示例11: addCloseFutureListener

import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public void addCloseFutureListener(SshFutureListener<CloseFuture> listener) {
    throw new RuntimeException("Not implemented");

}
 
开发者ID:NLeSC,项目名称:Xenon,代码行数:6,代码来源:MockClientSession.java

示例12: removeCloseFutureListener

import org.apache.sshd.common.future.CloseFuture; //导入依赖的package包/类
@Override
public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener) {
    throw new RuntimeException("Not implemented");

}
 
开发者ID:NLeSC,项目名称:Xenon,代码行数:6,代码来源:MockClientSession.java


注:本文中的org.apache.sshd.common.future.CloseFuture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。