org.rapidoid.job.Jobs.after()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.rapidoid.job.Jobs.after()方法的一些代码示例,展示了Jobs.after()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jobs.after()方法的具体详情如下:
包路径:org.rapidoid.job.Jobs
类名称:Jobs
方法名:after

Jobs.after介绍

暂无

代码示例

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> milliseconds(Runnable action) {
  return Jobs.after(delay, TimeUnit.MILLISECONDS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> days(Runnable action) {
  return Jobs.after(delay, TimeUnit.DAYS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> microseconds(Runnable action) {
  return Jobs.after(delay, TimeUnit.MICROSECONDS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> nanoseconds(Runnable action) {
  return Jobs.after(delay, TimeUnit.NANOSECONDS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> seconds(Runnable action) {
  return Jobs.after(delay, TimeUnit.SECONDS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> minutes(Runnable action) {
  return Jobs.after(delay, TimeUnit.MINUTES).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

public ScheduledFuture<Void> hours(Runnable action) {
  return Jobs.after(delay, TimeUnit.HOURS).run(action);
}

代码示例来源:origin: rapidoid/rapidoid

private void handleError(Throwable error, final Req req, final Resp resp, final ProxyMapping mapping, final int attempts, final long since) {
  if (error instanceof ConnectException || error instanceof IOException) {
    if (HttpUtils.isGetReq(req) && !U.timedOut(since, timeout())) {
      Jobs.after(retryDelay()).milliseconds(() -> process(req, resp, mapping, attempts + 1, since));
    } else {
      HttpIO.INSTANCE.errorAndDone(req, U.rte("Couldn't connect to the upstream!", error), LogLevel.DEBUG);
    }
  } else {
    HttpIO.INSTANCE.errorAndDone(req, error, LogLevel.ERROR);
  }
}

代码示例来源:origin: org.rapidoid/rapidoid-http-server

private void handleError(Throwable error, final Req req, final Resp resp, final ProxyMapping mapping, final int attempts, final long since) {
  if (error instanceof ConnectException || error instanceof IOException) {
    if (HttpUtils.isGetReq(req) && !Msc.timedOut(since, timeout())) {
      Jobs.after(retryDelay()).milliseconds(new Runnable() {
        @Override
        public void run() {
          process(req, resp, mapping, attempts + 1, since);
        }
      });
    } else {
      HttpIO.INSTANCE.errorAndDone(req, U.rte("Couldn't connect to the upstream!", error), LogLevel.DEBUG);
    }
  } else {
    HttpIO.INSTANCE.errorAndDone(req, error, LogLevel.ERROR);
  }
}

相关文章