Package com.netflix.astyanax.connectionpool.impl

Examples of com.netflix.astyanax.connectionpool.impl.SimpleRateLimiterImpl


        ConnectionPoolConfigurationImpl config = new ConnectionPoolConfigurationImpl(
                "cluster_keyspace");
        config.setConnectionLimiterMaxPendingCount(10);
        config.setConnectionLimiterWindowSize(1000);

        SimpleRateLimiterImpl limit = new SimpleRateLimiterImpl(config);

        int time = 0;
        boolean result;
        for (int i = 0; i < 10; i++) {
            time += 10;
            result = limit.check(time);
            Assert.assertTrue(result);
        }
        result = limit.check(time + 10);
        Assert.assertFalse(result);

        result = limit.check(time + 1000);
        Assert.assertTrue(result);
    }
View Full Code Here


        ConnectionPoolConfigurationImpl config = new ConnectionPoolConfigurationImpl(
                "cluster_keyspace");
        config.setConnectionLimiterMaxPendingCount(10);
        config.setConnectionLimiterWindowSize(1000);

        SimpleRateLimiterImpl limit = new SimpleRateLimiterImpl(config);

        int time = 0;
        int interval = 100;
        for (int i = 0; i < 10; i++) {
            time += interval;
            boolean result = limit.check(time);
            Assert.assertTrue(result);
        }
        boolean result = limit.check(time + interval);
        Assert.assertTrue(result);
    }
View Full Code Here

    public ThriftSyncConnectionFactoryImpl(AstyanaxConfiguration asConfig, ConnectionPoolConfiguration cpConfig, KeyspaceTracerFactory tracerFactory,
            ConnectionPoolMonitor monitor) {
        this.cpConfig = cpConfig;
        this.asConfig = asConfig;
        this.limiter = new SimpleRateLimiterImpl(cpConfig);
        this.tracerFactory = tracerFactory;
        this.monitor = monitor;
    }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.impl.SimpleRateLimiterImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.