private FreeMarkerService()

in src/main/java/org/apache/freemarker/onlinetester/services/FreeMarkerService.java [84:120]


    private FreeMarkerService(Builder bulder) {
        maxOutputLength = bulder.getMaxOutputLength();
        maxThreads = bulder.getMaxThreads();
        maxQueueLength = bulder.getMaxQueueLength();
        maxTemplateExecutionTime = bulder.getMaxTemplateExecutionTime();

        int actualMaxQueueLength = maxQueueLength != null
                ? maxQueueLength
                : Math.max(
                        MIN_DEFAULT_MAX_QUEUE_LENGTH,
                        (int) (MAX_DEFAULT_MAX_QUEUE_LENGTH_MILLISECONDS / maxTemplateExecutionTime));
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
                maxThreads, maxThreads,
                THREAD_KEEP_ALIVE_TIME, TimeUnit.MILLISECONDS,
                new BlockingArrayQueue<Runnable>(actualMaxQueueLength));
        threadPoolExecutor.allowCoreThreadTimeOut(true);
        templateExecutor = threadPoolExecutor;

        // Avoid ERROR log for using the actual current version. This application is special in that regard.
        Version latestVersion = new Version(Configuration.getVersion().toString());

        freeMarkerConfig = new Configuration(latestVersion);
        freeMarkerConfig.setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
        freeMarkerConfig.setObjectWrapper(new SimpleObjectWrapperWithXmlSupport(latestVersion));
        freeMarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
        freeMarkerConfig.setLogTemplateExceptions(false);
        freeMarkerConfig.setAttemptExceptionReporter(new AttemptExceptionReporter() {
			@Override
			public void report(TemplateException te, Environment env) {
				// Suppress it
			}
        });
        freeMarkerConfig.setLocale(AllowedSettingValues.DEFAULT_LOCALE);
        freeMarkerConfig.setTimeZone(AllowedSettingValues.DEFAULT_TIME_ZONE);
        freeMarkerConfig.setOutputFormat(AllowedSettingValues.DEFAULT_OUTPUT_FORMAT);
        freeMarkerConfig.setOutputEncoding("UTF-8");
    }