org.apache.sshd.common.future.CloseFuture Java Examples

The following examples show how to use org.apache.sshd.common.future.CloseFuture. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NettyIoSession.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  context.
      writeAndFlush(Unpooled.EMPTY_BUFFER).
      addListener(ChannelFutureListener.CLOSE).
      addListener(new GenericFutureListener<Future<? super Void>>() {
        @Override
        public void operationComplete(Future<? super Void> future) throws Exception {
          closeFuture.setClosed();
        }
      });
  return closeFuture;
}
 
Example #2
Source File: AsyncEchoShellFactory.java    From termd with Apache License 2.0 5 votes vote down vote up
@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);
        }
    });
}
 
Example #3
Source File: NettyIoServiceFactory.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  if (closeEventLoopGroup) {
    eventLoopGroup.shutdownGracefully().addListener((Future<Object> fut) -> {
      closeFuture.setClosed();
    });
  } else {
    closeFuture.setClosed();
  }
  return closeFuture;
}
 
Example #4
Source File: NettyIoSession.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  context.
      writeAndFlush(Unpooled.EMPTY_BUFFER).
      addListener(ChannelFutureListener.CLOSE).
      addListener(fut -> {
        closeFuture.setClosed();
      });
  return closeFuture;
}
 
Example #5
Source File: NettyIoServiceFactory.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  if (closeEventLoopGroup) {
    eventLoopGroup.shutdownGracefully().addListener((Future<Object> fut) -> {
      closeFuture.setClosed();
    });
  } else {
    closeFuture.setClosed();
  }
  return closeFuture;
}
 
Example #6
Source File: NettyIoSession.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
    context.
            writeAndFlush(Unpooled.EMPTY_BUFFER).
            addListener(ChannelFutureListener.CLOSE).
            addListener(fut -> {
                closeFuture.setClosed();
            });
    return closeFuture;
}
 
Example #7
Source File: AsyncEchoShellFactory.java    From termd with Apache License 2.0 5 votes vote down vote up
@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);
        }
    });
}
 
Example #8
Source File: NettyIoServiceFactory.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  if (closeEventLoopGroup) {
    eventLoopGroup.shutdownGracefully().addListener(new GenericFutureListener<Future<Object>>() {
      @Override
      public void operationComplete(Future<Object> future) throws Exception {
        closeFuture.setClosed();
      }
    });
  } else {
    closeFuture.setClosed();
  }
  return closeFuture;
}
 
Example #9
Source File: NettyIoAcceptor.java    From termd with Apache License 2.0 5 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  channelGroup.close().addListener(new GenericFutureListener<Future<? super Void>>() {
    @Override
    public void operationComplete(Future<? super Void> future) throws Exception {
      closeFuture.setClosed();
    }
  });
  return closeFuture;
}
 
Example #10
Source File: TtyCommand.java    From termd with Apache License 2.0 5 votes vote down vote up
private void close(final int exit) throws IOException {
  ioOut.close(false).addListener(new SshFutureListener<CloseFuture>() {
    @Override
    public void operationComplete(CloseFuture future) {
      exitCallback.onExit(exit);
      if (closed.compareAndSet(false, true)) {
        if (closeHandler != null) {
          closeHandler.accept(null);
        } else {
          // This happen : report it to the SSHD project
        }
      }
    }
  });
}
 
Example #11
Source File: TestServiceFactory.java    From termd with Apache License 2.0 4 votes vote down vote up
@Override
public CloseFuture close(boolean immediately) {
  factory.close(immediately);
  return super.close(immediately);
}
 
Example #12
Source File: NettyIoAcceptor.java    From aesh-readline with Apache License 2.0 4 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
    channelGroup.close().addListener(fut -> closeFuture.setClosed());
    return closeFuture;
}
 
Example #13
Source File: TestServiceFactory.java    From aesh-readline with Apache License 2.0 4 votes vote down vote up
@Override
public CloseFuture close(boolean immediately) {
  factory.close(immediately);
  return super.close(immediately);
}
 
Example #14
Source File: NettyIoAcceptor.java    From termd with Apache License 2.0 4 votes vote down vote up
@Override
protected CloseFuture doCloseGracefully() {
  channelGroup.close().addListener(fut -> closeFuture.setClosed());
  return closeFuture;
}
 
Example #15
Source File: TestServiceFactory.java    From termd with Apache License 2.0 4 votes vote down vote up
@Override
public CloseFuture close(boolean immediately) {
  factory.close(immediately);
  return super.close(immediately);
}
 
Example #16
Source File: MockClientSession.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Override
public void addCloseFutureListener(SshFutureListener<CloseFuture> listener) {
    throw new RuntimeException("Not implemented");

}
 
Example #17
Source File: MockClientSession.java    From xenon with Apache License 2.0 4 votes vote down vote up
@Override
public void removeCloseFutureListener(SshFutureListener<CloseFuture> listener) {
    throw new RuntimeException("Not implemented");

}