Ejemplo n.º 1
0
 void start() {
   connection.setErrorHandler(
       th -> {
         log.debug("QUIT failed, ignoring exception", th);
         resultHandler.handle(null);
       });
   connection.write(
       "QUIT",
       message -> {
         log.debug("QUIT result: " + message);
         if (!StatusCode.isStatusOk(message)) {
           log.warn("quit failed: " + message);
         }
         resultHandler.handle(null);
       });
 }
Ejemplo n.º 2
0
 @Override
 protected BlockingAction<Void> chownInternal(
     String path, String user, String group, Handler<AsyncResult<Void>> handler) {
   if (group != null && log.isDebugEnabled()) {
     log.debug("You are running on Windows and POSIX style file ownership is not supported");
   }
   return super.chownInternal(path, user, group, handler);
 }
 /**
  * Registers the required {@link MessageCodec} for the {@link SlackerRequest} and {@link
  * SlackerResponse} messages.
  */
 private void registerCodecs() {
   try {
     vertx
         .eventBus()
         .registerCodec(new SlackerRequestMessageCodec())
         .registerCodec(new SlackerResponseMessageCodec());
   } catch (final IllegalStateException e) {
     LOGGER.debug("codecs already registered", e);
   }
 }
  /**
   * Handles an incoming request from the event bus
   *
   * @param request the request message to be handled
   */
  private void handleExecutorEvent(final Message<SlackerRequest> request) {
    LOGGER.info("<=<= receiving incoming request <=<=");
    LOGGER.debug(request);

    // execute the request handling asynchronously
    context.runOnContext(
        a -> {
          final Future<SlackerResponse> future = futureFactory.future();
          execute(request.body(), future);
          future.setHandler(
              handler -> {
                if (handler.succeeded()) {
                  LOGGER.info("=>=> successfully handled request =>=>");
                  LOGGER.debug(handler.result());
                  request.reply(
                      handler.result(),
                      new DeliveryOptions().setCodecName(SlackerResponseMessageCodec.NAME));
                } else {
                  request.fail(ResultCode.ERROR.ordinal(), handler.cause().getMessage());
                  LOGGER.error("failed to handle request", handler.cause());
                }
              });
        });
  }
Ejemplo n.º 5
0
 private static void logInternal(final String perms) {
   if (perms != null && log.isDebugEnabled()) {
     log.debug("You are running on Windows and POSIX style file permissions are not supported");
   }
 }