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

com.github.sadstool.redissonaspectlock.attributes.configuration.DefaultConfigurationProvider Maven / Gradle / Ivy

The newest version!
package com.github.sadstool.redissonaspectlock.attributes.configuration;

import com.github.sadstool.redissonaspectlock.config.properties.LockProperties;

public class DefaultConfigurationProvider {

    public static final long DEFAULT_WAIT_TIME = 0;
    public static final long DEFAULT_LEASE_TIME = 10000;

    private LockConfiguration defaultConfiguration;

    public DefaultConfigurationProvider(LockProperties properties) {
        long defaultWaitTime = (properties.getWaitTime() != null) ? properties.getWaitTime() : DEFAULT_WAIT_TIME;
        long defaultLeaseTime = (properties.getLeaseTime() != null) ? properties.getLeaseTime() : DEFAULT_LEASE_TIME;

        defaultConfiguration = new LockConfiguration(defaultWaitTime, defaultLeaseTime);
    }

    public LockConfiguration getDefaultConfiguration() {
        return defaultConfiguration;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy