Java 类io.vertx.core.logging.Logger 实例源码

项目:vertx-acme4j    文件:AcmeManager.java   
<T> void fetchWithRetry(Logger logger, Callable<T> blockingHandler, Future<T> done) {
    vertx.executeBlocking((Future<T> fut) -> {
        try {
            fut.complete(blockingHandler.call());
        } catch (Exception e) {
            fut.fail(e);
        }
    }, ar -> {
        if (ar.failed() && !(ar.cause() instanceof AcmeRetryAfterException)) {
            done.fail(ar.cause());
            return;
        }
        if (ar.succeeded() && ar.result() != null) {
            done.complete(ar.result());
            return;
        }
        long nextSleep = ar.succeeded() ? 3000 : ((AcmeRetryAfterException) ar.cause()).getRetryAfter().getTime() - currentTimeMillis();
        logger.info("Recheck in {}ms @ {}", nextSleep, new Date(System.currentTimeMillis() + nextSleep));
        vertx.setTimer(nextSleep, timerId -> fetchWithRetry(logger, blockingHandler, done));
    });
}
项目:okapi    文件:MainDeploy.java   
public void init(String[] args, Handler<AsyncResult<Vertx>> fut) {
  final Logger logger = OkapiLogger.get();

  if (args.length < 1) {
    fut.handle(Future.failedFuture("Missing command; use help"));
    return;
  }
  if (parseOptions(args, fut)) {
    return;
  }
  final String mode = conf.getString("mode", "dev");
  switch (mode) {
    case "dev":
    case "initdatabase":
    case "purgedatabase":
      deploy(new MainVerticle(), conf, Vertx.vertx(vopt), fut);
      break;
    case "cluster":
    case "proxy":
    case "deployment":
      deployClustered(logger, fut);
      break;
    default:
      fut.handle(Future.failedFuture("Unknown command '" + mode + "'"));
  }
}
项目:vertx-unit    文件:RunTestOnContext.java   
@Override
public Statement apply(Statement base, Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      vertx = createVertx.get();
      try {
        Context context = vertx != null ? vertx.getOrCreateContext() : null;
        VertxUnitRunner.pushContext(context);
        base.evaluate();
      } finally {
        VertxUnitRunner.popContext();
        CountDownLatch latch = new CountDownLatch(1);
        closeVertx.accept(vertx, latch);
        try {
          if (!latch.await(30 * 1000, TimeUnit.MILLISECONDS)) {
            Logger logger = LoggerFactory.getLogger(description.getTestClass());
            logger.warn("Could not close Vert.x in tme");
          }
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
      }
    }
  };
}
项目:okapi    文件:MainCluster.java   
public static void main(String[] args) {
  MainDeploy d = new MainDeploy();
  d.init(args, res -> {
    if (res.failed()) {
      Logger logger = OkapiLogger.get();
      logger.error(res.cause());
      exit(1);
    }
  });
}
项目:okapi    文件:PostgresHandle.java   
public PostgresHandle(Vertx vertx, JsonObject conf) {
  JsonObject pgconf = new JsonObject();
  String val;

  val = Config.getSysConf("postgres_host", "", conf);
  if (!val.isEmpty()) {
    pgconf.put("host", val);
  }
  val = Config.getSysConf("postgres_port", "", conf);
  Logger logger = OkapiLogger.get();
  if (!val.isEmpty()) {
    try {
      Integer x = Integer.parseInt(val);
      pgconf.put("port", x);
    } catch (NumberFormatException e) {
      logger.warn("Bad postgres_port value: " + val + ": " + e.getMessage());
    }
  }
  val = Config.getSysConf("postgres_username", Config.getSysConf("postgres_user", "okapi", conf), conf);
  if (!val.isEmpty()) {
    pgconf.put("username", val);
  }
  val = Config.getSysConf("postgres_password", "okapi25", conf);
  if (!val.isEmpty()) {
    pgconf.put("password", val);
  }
  val = Config.getSysConf("postgres_database", "okapi", conf);
  if (!val.isEmpty()) {
    pgconf.put("database", val);
  }
  logger.debug("Connecting to postgres with " + pgconf.encode());
  cli = PostgreSQLClient.createNonShared(vertx, pgconf);
  logger.debug("created");
}
项目:sfs    文件:AsyncFileWriterImpl.java   
public AsyncFileWriterImpl(long startPosition, WriteQueueSupport<AsyncFileWriter> writeQueueSupport, Context context, AsynchronousFileChannel dataFile, Logger log) {
    this.log = log;
    this.startPosition = startPosition;
    this.writePos = startPosition;
    this.ch = dataFile;
    this.context = context;
    this.writeQueueSupport = writeQueueSupport;
    this.lastWriteTime = System.currentTimeMillis();
}
项目:sfs    文件:AsyncFileReaderImpl.java   
public AsyncFileReaderImpl(Context context, long startPosition, int bufferSize, long length, AsynchronousFileChannel dataFile, Logger log) {
    this.log = log;
    this.bufferSize = bufferSize;
    this.readPos = startPosition;
    this.bytesRemaining = length;
    this.startPosition = startPosition;
    this.ch = dataFile;
    this.context = context;
}
项目:nubes    文件:AsyncUtils.java   
static <T> Handler<AsyncResult<T>> logIfFailed(final String msg, final Logger log) {
  return res -> {
    if (res.failed()) {
      if (msg != null) {
        log.error(msg, res.cause());
      } else {
        log.error(res.cause());
      }
    }
  };
}
项目:vertx-zero    文件:TestBase.java   
protected Logger getLogger() {
    return LoggerFactory.getLogger(getClass());
}
项目:vertx-zero    文件:Log.java   
public static void jvm(final Logger logger, final Throwable ex) {
    Fn.safeNull(logger::warn, ex);
    ex.printStackTrace();
}
项目:vertx-zero    文件:Log.java   
public static void zero(final Logger logger, final ZeroException ex) {
    Fn.safeNull(logger::warn, ex);
}
项目:vertx-zero    文件:Log.java   
public static void vertx(final Logger logger, final VertxException ex) {
    Fn.safeNull(logger::warn, ex);
}
项目:vertx-zero    文件:Log.java   
public static void info(final Logger logger, final String pattern, final Object... rest) {
    log(logger::isInfoEnabled, logger::info, pattern, rest);
}
项目:vertx-zero    文件:Log.java   
public static void debug(final Logger logger, final String pattern, final Object... rest) {
    log(() -> true, logger::debug, pattern, rest);
}
项目:vertx-zero    文件:Log.java   
public static void warn(final Logger logger, final String pattern, final Object... rest) {
    log(() -> true, logger::warn, pattern, rest);
}
项目:vertx-zero    文件:Log.java   
public static void error(final Logger logger, final String pattern, final Object... rest) {
    log(() -> true, logger::error, pattern, rest);
}
项目:vertx-acme4j    文件:AcmeManager.java   
<T> Future<T> fetchWithRetry(Logger logger, Callable<T> blockingHandler) {
    return future((Future<T> fut) -> fetchWithRetry(logger, blockingHandler, fut));
}
项目:vertx-swagger    文件:VerticleHelper.java   
public VerticleHelper(Logger logger) {
    this.logger = logger;
}
项目:vertx-swagger    文件:VerticleHelper.java   
public VerticleHelper(Logger logger) {
    this.logger = logger;
}
项目:vertx-swagger    文件:VerticleHelper.java   
public VerticleHelper(Logger logger) {
    this.logger = logger;
}
项目:vertx-swagger    文件:VerticleHelper.java   
public VerticleHelper(Logger logger) {
    this.logger = logger;
}
项目:okapi    文件:OkapiLogger.java   
public static Logger get() {
  System.setProperty("vertx.logger-delegate-factory-class-name",
    "io.vertx.core.logging.SLF4JLogDelegateFactory");
  return LoggerFactory.getLogger("okapi");
}
项目:scales    文件:EventBusServiceHelper.java   
public EventBusServiceHelper(Vertx vertx, Logger logger) {
    this.vertx = vertx;
    this.logger = logger;
}
项目:georocket    文件:RxUtils.java   
/**
 * <p>Create a function that can be passed to {@link rx.Observable#retryWhen(Func1)}
 * in order to create a stream that is retried multiple times before failing.</p>
 * <p>Example:</p>
 * <pre>
 * Observable.create(subscriber -&gt; {
 *    // retryWhen will re-subscribe in case of error so this code
 *    // will be executed 5 times and finally fail with the given exception
 *    Observable.&lt;String&gt;error(new IllegalStateException()).subscribe(subscriber);
 * }).retryWhen(RxUtils.makeRetry(5, 1000, null));
 * </pre>
 * @param retries the number of retries
 * @param interval the number of milliseconds to wait before a retry
 * @param log optional logger used to record failed attempts (may be null)
 * @return a function that can be passed to {@link rx.Observable#retryWhen(Func1)}
 */
public static Func1<Observable<? extends Throwable>, Observable<Long>> makeRetry(
    int retries, int interval, Logger log) {
  return attempts -> {
    return attempts.zipWith(Observable.range(1, retries + 1), (n, i) -> Pair.of(n, i)).flatMap(t -> {
      if (t.getValue() > retries) {
        return Observable.error(t.getKey());
      }
      if (log != null) {
        log.warn("Operation failed", t.getKey());
        log.info("Retry " + t.getValue() + " in " + interval + " milliseconds");
      }
      return Observable.timer(interval, TimeUnit.MILLISECONDS);
    });
  };
}
项目:vertx-infinispan    文件:JGroupsLoggerAdapter.java   
public JGroupsLoggerAdapter(Logger logger) {
  this.logger = logger;
}
项目:vertx-jgroups    文件:JGroupsClusterManager.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:RpcServerObjDelegate.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:DefaultRpcExecutorService.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:DefaultRpcMultiMapService.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:DefaultRpcMapService.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:CacheManager.java   
@Override
public Logger log() {
    return LOG;
}
项目:vertx-jgroups    文件:TopologyListener.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:MultiMapImpl.java   
@Override
public Logger log() {
  return log;
}
项目:vertx-jgroups    文件:ClusteredLockImpl.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:SyncMapWrapper.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:AsyncMultiMapWrapper.java   
@Override
public Logger log() {
  return LOG;
}
项目:vertx-jgroups    文件:AsyncMapWrapper.java   
@Override
public Logger log() {
  return LOG;
}
项目:apiman    文件:VertxLoggerDelegate.java   
public VertxApimanLogger(Logger logger) {
    this.logger = logger;
}
项目:apiman    文件:ApimanVerticleBase.java   
protected Logger getLogger() {
    return log;
}
项目:apiman    文件:EBInMemoryRegistry.java   
@Override
public Logger log() {
    return log;
}