io.vertx.core.VertxOptions.setWarningExceptionTime()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(150)

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

VertxOptions.setWarningExceptionTime介绍

[英]Set the threshold value above this, the blocked warning contains a stack trace. in VertxOptions#setWarningExceptionTimeUnit. The default value of VertxOptions#setWarningExceptionTimeUnit is TimeUnit#NANOSECONDS
[中]如果将阈值设置为高于此值,则阻止的警告将包含堆栈跟踪。在VertxOptions中#设置WarningExceptionTimeUnit。VertxOptions#setWarningExceptionTimeUnit的默认值为时间单位#纳秒

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

case "warningExceptionTime":
 if (member.getValue() instanceof Number) {
  obj.setWarningExceptionTime(((Number)member.getValue()).longValue());

代码示例来源:origin: eclipse/hono

/**
 * Exposes a Vert.x instance as a Spring bean.
 *
 * @return The Vert.x instance.
 */
@Bean
public Vertx vertx() {
  final VertxOptions options = new VertxOptions()
      .setWarningExceptionTime(1500000000)
      .setAddressResolverOptions(addressResolverOptions());
  return Vertx.vertx(options);
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testBlockCheckExceptionTimeLimit() throws Exception {
 Verticle verticle = new AbstractVerticle() {
  @Override
  public void start() throws InterruptedException {
   Thread.sleep(3000);
   testComplete();
  }
 };
 // set warning threshold to 1s and the exception threshold as well
 long maxEventLoopExecuteTime = 1;
 TimeUnit maxEventLoopExecuteTimeUnit = SECONDS;
 VertxOptions vertxOptions = new VertxOptions();
 vertxOptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
 vertxOptions.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit);
 vertxOptions.setWarningExceptionTime(maxEventLoopExecuteTime);
 vertxOptions.setWarningExceptionTimeUnit(maxEventLoopExecuteTimeUnit);
 Vertx newVertx = vertx(vertxOptions);
 newVertx.deployVerticle(verticle);
 await();
 blockedThreadWarning.expectMessage("vert.x-eventloop-thread", maxEventLoopExecuteTime, maxEventLoopExecuteTimeUnit);
}

代码示例来源:origin: mpusher/mpns

@Override
public void beforeStartingVertx(VertxOptions options) {
  super.beforeStartingVertx(options);
  System.setProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME, SLF4JLogDelegateFactory.class.getName());
  options.setWarningExceptionTime(
      config.getLong(VERTX_OPTIONS_PROP_PREFIX + "warningExceptionTime", options.getWarningExceptionTime())
  );
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
 public void testBlockCheckExecuteBlocking() throws Exception {
  Verticle verticle = new AbstractVerticle() {
   @Override
   public void start() throws InterruptedException {
    vertx.executeBlocking(fut -> {
     try {
      Thread.sleep(3000);
     } catch (InterruptedException e) {
      fail();
     }
     testComplete();
    }, ar -> {});
   }
  };
  // set warning threshold to 1s and the exception threshold as well
  long maxWorkerExecuteTime = 1;
  TimeUnit maxWorkerExecuteTimeUnit = SECONDS;
  VertxOptions vertxOptions = new VertxOptions();
  vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
  vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);
  vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime);
  vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit);
  Vertx newVertx = vertx(vertxOptions);
  newVertx.deployVerticle(verticle);
  await();
  blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit);
 }
}

代码示例来源:origin: de.braintags/vertx-pojo-mapper-common-test

/**
 * Creates the VertxOptions by checking System variables BlockedThreadCheckInterval and WarningExceptionTime
 * 
 * @deprecated Use {@link BtVertxTestBase#getOptions()}
 */
@Deprecated
public static VertxOptions getOptions() {
 VertxOptions options = new VertxOptions();
 String blockedThreadCheckInterval = System.getProperty("BlockedThreadCheckInterval");
 if (blockedThreadCheckInterval != null) {
  logger.info("setting setBlockedThreadCheckInterval to " + blockedThreadCheckInterval);
  options.setBlockedThreadCheckInterval(Long.parseLong(blockedThreadCheckInterval));
 }
 String warningExceptionTime = System.getProperty("WarningExceptionTime");
 if (warningExceptionTime != null) {
  logger.info("setting setWarningExceptionTime to " + warningExceptionTime);
  options.setWarningExceptionTime(Long.parseLong(warningExceptionTime));
 }
 return options;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testBlockCheckWorker() throws Exception {
 Verticle verticle = new AbstractVerticle() {
  @Override
  public void start() throws InterruptedException {
   Thread.sleep(3000);
   testComplete();
  }
 };
 // set warning threshold to 1s and the exception threshold as well
 long maxWorkerExecuteTime = 1;
 TimeUnit maxWorkerExecuteTimeUnit = SECONDS;
 VertxOptions vertxOptions = new VertxOptions();
 vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
 vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);
 vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime);
 vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit);
 Vertx newVertx = vertx(vertxOptions);
 DeploymentOptions deploymentOptions = new DeploymentOptions();
 deploymentOptions.setWorker(true);
 newVertx.deployVerticle(verticle, deploymentOptions);
 await();
 blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit);
}

代码示例来源:origin: eclipse/hono

final Vertx vertx() {
  final VertxOptions options = new VertxOptions()
      .setWarningExceptionTime(1500000000)
      .setAddressResolverOptions(new AddressResolverOptions()
          .setCacheNegativeTimeToLive(0) // discard failed DNS lookup results immediately
          .setCacheMaxTimeToLive(0) // support DNS based service resolution
          .setRotateServers(true)
          .setQueryTimeout(DEFAULT_ADDRESS_RESOLUTION_TIMEOUT_MILLIS));
  return Vertx.vertx(options);
}

代码示例来源:origin: eclipse-vertx/vert.x

new MetricsOptions().
    setEnabled(metricsEnabled));
options.setWarningExceptionTime(warningExceptionTime);
options.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit);
options.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);

代码示例来源:origin: org.eclipse.hono/hono-service-device-registry

/**
 * Gets the singleton Vert.x instance to be used by Hono.
 * 
 * @return the instance.
 */
@Bean
public Vertx vertx() {
  final VertxOptions options = new VertxOptions()
      .setWarningExceptionTime(1500000000)
      .setAddressResolverOptions(new AddressResolverOptions()
          .setCacheNegativeTimeToLive(0) // discard failed DNS lookup results immediately
          .setCacheMaxTimeToLive(0) // support DNS based service resolution
          .setQueryTimeout(1000));
  vertxProperties().configureVertx(options);
  return Vertx.vertx(options);
}

代码示例来源:origin: io.vertx/vertx-core

case "warningExceptionTime":
 if (member.getValue() instanceof Number) {
  obj.setWarningExceptionTime(((Number)member.getValue()).longValue());

代码示例来源:origin: org.eclipse.hono/hono-service-base

/**
 * Exposes a Vert.x instance as a Spring bean.
 *
 * @return The Vert.x instance.
 */
@Bean
public Vertx vertx() {
  final VertxOptions options = new VertxOptions()
      .setWarningExceptionTime(1500000000)
      .setAddressResolverOptions(new AddressResolverOptions()
          .setCacheNegativeTimeToLive(0) // discard failed DNS lookup results immediately
          .setCacheMaxTimeToLive(0) // support DNS based service resolution
          .setQueryTimeout(1000));
  vertxProperties().configureVertx(options);
  return Vertx.vertx(options);
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testBlockCheckExceptionTimeLimit() throws Exception {
 Verticle verticle = new AbstractVerticle() {
  @Override
  public void start() throws InterruptedException {
   Thread.sleep(3000);
   testComplete();
  }
 };
 // set warning threshold to 1s and the exception threshold as well
 long maxEventLoopExecuteTime = 1;
 TimeUnit maxEventLoopExecuteTimeUnit = SECONDS;
 VertxOptions vertxOptions = new VertxOptions();
 vertxOptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
 vertxOptions.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit);
 vertxOptions.setWarningExceptionTime(maxEventLoopExecuteTime);
 vertxOptions.setWarningExceptionTimeUnit(maxEventLoopExecuteTimeUnit);
 Vertx newVertx = vertx(vertxOptions);
 newVertx.deployVerticle(verticle);
 await();
 blockedThreadWarning.expectMessage("vert.x-eventloop-thread", maxEventLoopExecuteTime, maxEventLoopExecuteTimeUnit);
}

代码示例来源:origin: de.braintags/vertx-util

/**
 * Creates the VertxOptions by checking System variables BlockedThreadCheckInterval and WarningExceptionTime
 */
public static VertxOptions getVertxOptions() {
 VertxOptions options = new VertxOptions();
 String blockedThreadCheckInterval = System.getProperty("BlockedThreadCheckInterval");
 if (blockedThreadCheckInterval != null) {
  LOGGER.info("setting setBlockedThreadCheckInterval to " + blockedThreadCheckInterval);
  options.setBlockedThreadCheckInterval(Long.parseLong(blockedThreadCheckInterval));
 }
 String warningExceptionTime = System.getProperty("WarningExceptionTime");
 if (warningExceptionTime != null) {
  LOGGER.info("setting setWarningExceptionTime to " + warningExceptionTime);
  options.setWarningExceptionTime(Long.parseLong(warningExceptionTime));
 }
 return options;
}

代码示例来源:origin: io.vertx/vertx-core

@Test
 public void testBlockCheckExecuteBlocking() throws Exception {
  Verticle verticle = new AbstractVerticle() {
   @Override
   public void start() throws InterruptedException {
    vertx.executeBlocking(fut -> {
     try {
      Thread.sleep(3000);
     } catch (InterruptedException e) {
      fail();
     }
     testComplete();
    }, ar -> {});
   }
  };
  // set warning threshold to 1s and the exception threshold as well
  long maxWorkerExecuteTime = 1;
  TimeUnit maxWorkerExecuteTimeUnit = SECONDS;
  VertxOptions vertxOptions = new VertxOptions();
  vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
  vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);
  vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime);
  vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit);
  Vertx newVertx = vertx(vertxOptions);
  newVertx.deployVerticle(verticle);
  await();
  blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit);
 }
}

代码示例来源:origin: org.amv.vertx/amv-vertx-spring-boot-starter

@ConditionalOnMissingBean(VertxOptions.class)
@Bean
public VertxOptions vertxOptions(EventBusOptions eventBusOptions, MetricsOptions metricsOptions) {
  return new VertxOptions()
      .setBlockedThreadCheckInterval(properties.getBlockedThreadCheckInterval())
      .setEventLoopPoolSize(properties.getEventLoopPoolSize())
      .setWorkerPoolSize(properties.getWorkerPoolSize())
      .setInternalBlockingPoolSize(properties.getInternalBlockingPoolSize())
      .setQuorumSize(properties.getQuorumSize())
      .setMaxEventLoopExecuteTime(properties.getMaxEventLoopExecuteTime())
      .setHAGroup(properties.getHaGroup())
      .setMaxWorkerExecuteTime(properties.getMaxWorkerExecuteTime())
      .setWarningExceptionTime(properties.getWarningExceptionTime())
      .setFileResolverCachingEnabled(properties.isFileResolverCachingEnabled())
      .setHAEnabled(properties.isHaEnabled())
      .setEventBusOptions(eventBusOptions)
      .setMetricsOptions(metricsOptions);
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testBlockCheckWorker() throws Exception {
 Verticle verticle = new AbstractVerticle() {
  @Override
  public void start() throws InterruptedException {
   Thread.sleep(3000);
   testComplete();
  }
 };
 // set warning threshold to 1s and the exception threshold as well
 long maxWorkerExecuteTime = 1;
 TimeUnit maxWorkerExecuteTimeUnit = SECONDS;
 VertxOptions vertxOptions = new VertxOptions();
 vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
 vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);
 vertxOptions.setWarningExceptionTime(maxWorkerExecuteTime);
 vertxOptions.setWarningExceptionTimeUnit(maxWorkerExecuteTimeUnit);
 Vertx newVertx = vertx(vertxOptions);
 DeploymentOptions deploymentOptions = new DeploymentOptions();
 deploymentOptions.setWorker(true);
 newVertx.deployVerticle(verticle, deploymentOptions);
 await();
 blockedThreadWarning.expectMessage("vert.x-worker-thread", maxWorkerExecuteTime, maxWorkerExecuteTimeUnit);
}

代码示例来源:origin: eclipse-vertx/vert.x

options.setWarningExceptionTime(-1);
 fail("Should throw exception");
} catch (IllegalArgumentException e) {
assertEquals(options, options.setWarningExceptionTime(1000000000l));
assertEquals(1000000000l, options.getWarningExceptionTime());

代码示例来源:origin: io.vertx/vertx-core

new MetricsOptions().
    setEnabled(metricsEnabled));
options.setWarningExceptionTime(warningExceptionTime);
options.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit);
options.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);

代码示例来源:origin: io.vertx/vertx-core

options.setWarningExceptionTime(-1);
 fail("Should throw exception");
} catch (IllegalArgumentException e) {
assertEquals(options, options.setWarningExceptionTime(1000000000l));
assertEquals(1000000000l, options.getWarningExceptionTime());

相关文章

VertxOptions类方法