All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deepsense.neptune.clientlibrary.config.internal.FileBasedInternalConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
/**
 * Copyright (c) 2016, CodiLime Inc.
 */

package io.deepsense.neptune.clientlibrary.config.internal;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

public class FileBasedInternalConfiguration implements InternalConfiguration {

    private final ChannelValueBufferConfiguration channelValueBufferConfiguration;

    private final ChannelValueSendingThreadConfiguration channelValueSendingThreadConfiguration;

    private final RequestRetryConfiguration requestRetryStrategyConfiguration;

    public FileBasedInternalConfiguration() {

        Config conf = ConfigFactory.load();

        channelValueBufferConfiguration = new ChannelValueBufferConfiguration(
                conf.getInt("channelValueBuffer.maxPackageCount"),
                conf.getDouble("channelValueBuffer.maxBatchSizeAsFractionOfRequestSize"),
                conf.getLong("channelValueBuffer.minIntervalBetweenSends")
        );
        channelValueSendingThreadConfiguration = new ChannelValueSendingThreadConfiguration(
                conf.getInt("channelValueSendingThread.queueSize")
        );
        requestRetryStrategyConfiguration = new RequestRetryConfiguration(
                conf.getBoolean("requestRetry.isRetryingTurnedOn"),
                conf.getLong("requestRetry.maxTimeoutBetweenRequestsInMillis")
        );
    }

    @Override
    public ChannelValueBufferConfiguration getChannelValueBufferConfiguration() {
        return channelValueBufferConfiguration;
    }

    @Override
    public ChannelValueSendingThreadConfiguration getChannelValueSendingThreadConfiguration() {
        return channelValueSendingThreadConfiguration;
    }

    @Override
    public RequestRetryConfiguration getRequestRetryStrategy() {
        return requestRetryStrategyConfiguration;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy