io.vertx.core.file.FileSystemOptions Java Examples

The following examples show how to use io.vertx.core.file.FileSystemOptions. 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: VertxProperties.java    From vertx-spring-boot with Apache License 2.0 4 votes vote down vote up
public VertxOptions toVertxOptions() {
    VertxOptions vertxOptions = new VertxOptions();
    vertxOptions.setEventLoopPoolSize(eventLoopPoolSize);
    vertxOptions.setWorkerPoolSize(workerPoolSize);
    vertxOptions.setInternalBlockingPoolSize(internalBlockingPoolSize);
    vertxOptions.setBlockedThreadCheckInterval(blockedThreadCheckInterval);
    vertxOptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);
    vertxOptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);
    vertxOptions.setHAEnabled(haEnabled);
    vertxOptions.setQuorumSize(quorumSize);
    vertxOptions.setHAGroup(haGroup);
    vertxOptions.setWarningExceptionTime(warningExceptionTime);
    vertxOptions.setPreferNativeTransport(preferNativeTransport);
    vertxOptions.setMaxEventLoopExecuteTimeUnit(maxEventLoopExecuteTimeUnit);
    vertxOptions.setMaxWorkerExecuteTimeUnit(maxWorkerExecuteTimeUnit);
    vertxOptions.setWarningExceptionTimeUnit(warningExceptionTimeUnit);
    vertxOptions.setBlockedThreadCheckIntervalUnit(blockedThreadCheckIntervalUnit);

    MetricsOptions metricsOptions = new MetricsOptions();
    metricsOptions.setEnabled(metricsEnabled);
    vertxOptions.setMetricsOptions(metricsOptions);

    FileSystemOptions fileSystemOptions = new FileSystemOptions();
    fileSystemOptions.setClassPathResolvingEnabled(fileSystem.isClassPathResolvingEnabled());
    fileSystemOptions.setFileCachingEnabled(fileSystem.isFileCachingEnabled());
    vertxOptions.setFileSystemOptions(fileSystemOptions);

    AddressResolverOptions addressResolverOptions = new AddressResolverOptions();
    addressResolverOptions.setHostsPath(addressResolver.getHostsPath());
    addressResolverOptions.setHostsValue(addressResolver.getHostsValue());
    addressResolverOptions.setServers(addressResolver.getServers());
    addressResolverOptions.setOptResourceEnabled(addressResolver.isOptResourceEnabled());
    addressResolverOptions.setCacheMinTimeToLive(addressResolver.getCacheMinTimeToLive());
    addressResolverOptions.setCacheMaxTimeToLive(addressResolver.getCacheMaxTimeToLive());
    addressResolverOptions.setCacheNegativeTimeToLive(addressResolver.getCacheNegativeTimeToLive());
    addressResolverOptions.setQueryTimeout(addressResolver.getQueryTimeout());
    addressResolverOptions.setMaxQueries(addressResolver.getMaxQueries());
    addressResolverOptions.setRdFlag(addressResolver.isRdFlag());
    addressResolverOptions.setSearchDomains(addressResolver.getSearchDomains());
    addressResolverOptions.setNdots(addressResolver.getNdots());
    addressResolverOptions.setRotateServers(addressResolver.isRotateServers());
    vertxOptions.setAddressResolverOptions(addressResolverOptions);

    return vertxOptions;
}
 
Example #2
Source File: VertxCoreRecorder.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private static VertxOptions convertToVertxOptions(VertxConfiguration conf, VertxOptions options, boolean allowClustering) {

        if (!conf.useAsyncDNS) {
            System.setProperty(ResolverProvider.DISABLE_DNS_RESOLVER_PROP_NAME, "true");
        }

        if (allowClustering) {
            // Order matters, as the cluster options modifies the event bus options.
            setEventBusOptions(conf, options);
            initializeClusterOptions(conf, options);
        }

        String fileCacheDir = System.getProperty(CACHE_DIR_BASE_PROP_NAME,
                System.getProperty("java.io.tmpdir", ".") + File.separator + "vertx-cache");

        options.setFileSystemOptions(new FileSystemOptions()
                .setFileCachingEnabled(conf.caching)
                .setFileCacheDir(fileCacheDir)
                .setClassPathResolvingEnabled(conf.classpathResolving));
        options.setWorkerPoolSize(conf.workerPoolSize);
        options.setInternalBlockingPoolSize(conf.internalBlockingPoolSize);

        options.setBlockedThreadCheckInterval(conf.warningExceptionTime.toMillis());
        if (conf.eventLoopsPoolSize.isPresent()) {
            options.setEventLoopPoolSize(conf.eventLoopsPoolSize.getAsInt());
        } else {
            options.setEventLoopPoolSize(calculateDefaultIOThreads());
        }

        Optional<Duration> maxEventLoopExecuteTime = conf.maxEventLoopExecuteTime;
        if (maxEventLoopExecuteTime.isPresent()) {
            options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime.get().toMillis());
            options.setMaxEventLoopExecuteTimeUnit(TimeUnit.MILLISECONDS);
        }

        Optional<Duration> maxWorkerExecuteTime = conf.maxWorkerExecuteTime;
        if (maxWorkerExecuteTime.isPresent()) {
            options.setMaxWorkerExecuteTime(maxWorkerExecuteTime.get().toMillis());
            options.setMaxWorkerExecuteTimeUnit(TimeUnit.MILLISECONDS);
        }

        options.setWarningExceptionTime(conf.warningExceptionTime.toNanos());

        options.setPreferNativeTransport(conf.preferNativeTransport);

        return options;
    }
 
Example #3
Source File: MainDeploy.java    From okapi with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"squid:S1181"})
void init(String[] args, Handler<AsyncResult<Vertx>> fut) {
  vopt.setPreferNativeTransport(true);
  try {
    final Logger logger = OkapiLogger.get();
    Messages.setLanguage(System.getProperty("lang", "en"));

    if (args.length < 1) {
      printUsage();
      fut.handle(Future.failedFuture(messages.getMessage("10600")));
      return;
    }
    if (parseOptions(args, fut)) {
      return;
    }
    final String mode = conf.getString("mode", "dev");
    switch (mode) {
      case "dev":
      case "initdatabase":
      case "purgedatabase":
        deploy(new MainVerticle(), Vertx.vertx(vopt), fut);
        break;
      case "cluster":
      case "proxy":
      case "deployment":
        deployClustered(logger, fut);
        break;
      default:
        fut.handle(Future.failedFuture(messages.getMessage("10601", mode)));
    }
  } catch (Throwable t) {
    String message = t.getMessage();
    if ("Failed to create cache dir".equals(message)) {
      // https://issues.folio.org/browse/OKAPI-857 Okapi crashes on user change
      // https://github.com/eclipse-vertx/vert.x/blob/3.9.1/src/main/java/io/vertx/core/file/FileSystemOptions.java#L49
      message += " " + FileSystemOptions.DEFAULT_FILE_CACHING_DIR;
      t = new RuntimeException(message, t);
    }
    fut.handle(Future.failedFuture(t));
  }
}
 
Example #4
Source File: ThymeleafTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #5
Source File: ThymeleafTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(false)));
}
 
Example #6
Source File: FreeMarkerTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #7
Source File: FreeMarkerTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(false)));
}
 
Example #8
Source File: HTTLTemplateEngineTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #9
Source File: HandlebarsTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #10
Source File: HandlebarsTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #11
Source File: PebbleTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #12
Source File: PebbleTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(false)));
}
 
Example #13
Source File: JadeTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(false)));
}
 
Example #14
Source File: JadeTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}
 
Example #15
Source File: MVELTemplateNoCacheTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(false)));
}
 
Example #16
Source File: MVELTemplateTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void before() {
  vertx = Vertx.vertx(new VertxOptions().setFileSystemOptions(new FileSystemOptions().setFileCachingEnabled(true)));
}