public void init()

in geronimo-opentracing-common/src/main/java/org/apache/geronimo/microprofile/opentracing/common/microprofile/zipkin/ZipkinHttp.java [70:127]


    public void init() {
        if (jsonb == null) {
            jsonb = JsonbBuilder.create();
        }
        final int capacity = Integer.parseInt(
                config.read("span.converter.zipkin.http.bufferSize", "1000000"));
        maxSpansPerBulk = Integer.parseInt(
                config.read("span.converter.zipkin.http.maxSpansPerBulk", "250"));
        maxSpansIteration = Integer.parseInt(
                config.read("span.converter.zipkin.http.maxSpansIteration", "-1"));
        collector = config.read("span.converter.zipkin.http.collector", null);
        if (collector == null) {
            return;
        }

        final long delay = Long.parseLong(
                config.read("span.converter.zipkin.http.bulkSendInterval", "60000"));
        if (delay < 0) {
            logger().severe("No span.converter.zipkin.http.bulkSendInterval configured, skipping");
            collector = null; // to skip anything
            return;
        }
        if (delay > 0) {
            executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    final Thread thread = new Thread(r, getClass().getName() + "-executor");
                    thread.setPriority(Thread.NORM_PRIORITY);
                    thread.setDaemon(false);
                    return thread;
                }
            });
            scheduledTask = executor.scheduleAtFixedRate(this::onEmit, delay, delay, MILLISECONDS);
            spans = new ArrayBlockingQueue<>(capacity);
        } else { // == 0 => immediate send
            spans = null;
        }
        final ClientBuilder clientBuilder = ClientBuilder.newBuilder()
                .connectTimeout(Long.parseLong(config.read("span.converter.zipkin.http.connectTimeout", "30000")), MILLISECONDS)
                .readTimeout(Long.parseLong(config.read("span.converter.zipkin.http.readTimeout", "30000")), MILLISECONDS);
        ofNullable(config.read("span.converter.zipkin.http.providers", null))
                .ifPresent(providers -> Stream.of(providers.split(","))
                    .map(String::trim)
                    .map(it -> {
                        try {
                            return Thread.currentThread().getContextClassLoader().loadClass(it)
                                    .getConstructor().newInstance();
                        } catch (final Exception e) {
                            throw new IllegalArgumentException(e);
                        }
                    })
                    .forEach(clientBuilder::register));
        if (Boolean.parseBoolean(config.read("span.converter.zipkin.http.selfTrace", "false"))) {
            ClientTracingRegistrar.configure(clientBuilder);
        }
        client = clientBuilder.build();
        logger().info("Zipkin http sender configured");
    }