@Override public void onStartup(Container container) { LOGGER.info("Standalone conversion server is starting: starting up local converter"); LocalConverter.Builder builder = LocalConverter.builder() .baseFolder(baseFolder) .processTimeout(processTimeout, TimeUnit.MILLISECONDS) .workerPool(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MILLISECONDS); for (Map.Entry<Class<? extends IExternalConverter>, Boolean> entry : converterConfiguration.entrySet()) { LOGGER.info("{} converter: %s", entry.getValue() ? "ENABLED" : "DISABLED", entry.getKey()); builder = entry.getValue() ? builder.enable(entry.getKey()) : builder.disable(entry.getKey()); } this.converter = builder.build(); LOGGER.info("Standalone conversion server is starting: local converter is started"); }
/** * Specifies a global timeout for external processes. After the specified amount of milliseconds * any conversion process will be killed and the conversion will result with an error. This timeout * also applies for starting up or terminating an external converter. * * @param processTimeout The process timeout. * @param timeUnit The time unit of the specified process timeout. * @return This builder instance. */ public Builder processTimeout(long processTimeout, TimeUnit timeUnit) { assertNumericArgument(processTimeout, true); this.processTimeout = timeUnit.toMillis(processTimeout); return this; }
@Override public IConverter build() { return new LocalConverter(normalizedBaseFolder(), corePoolSize, maximumPoolSize, keepAliveTime, processTimeout, TimeUnit.MILLISECONDS, converterConfiguration); }
/** * Creates a new builder instance. * * @return A new builder instance. */ public static Builder builder() { return new Builder(); }
/** * Creates a new {@link LocalConverter} with default configuration. * * @return A {@link LocalConverter} with default configuration. */ public static IConverter make() { return builder().build(); }