Examples of TenacityPropertyRegister


Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

        }
    }

    protected void registerTenacityProperties(Map<TenacityPropertyKey, TenacityConfiguration> tenacityPropertyKeyConfigurations,
                                              T configuration) {
        new TenacityPropertyRegister(
                tenacityPropertyKeyConfigurations,
                tenacityBundleConfigurationFactory.getBreakerboxConfiguration(configuration)
        ).register();
    }
View Full Code Here

Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

    @Test(expected = HystrixRuntimeException.class)
    public void shouldThrowWhenAuthenticateTimesOut() throws AuthenticationException {
        final TenacityConfiguration overrideConfiguration = new TenacityConfiguration();
        overrideConfiguration.setExecutionIsolationThreadTimeoutInMillis(1);

        new TenacityPropertyRegister(
                ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.TENACITY_AUTH_TIMEOUT, overrideConfiguration),
                new BreakerboxConfiguration(),
                mock(ArchaiusPropertyRegister.class))
            .register();
View Full Code Here

Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

    @Test
    public void exceptionsShouldMapTimeouts() throws AuthenticationException {
        try {
            final TenacityConfiguration timeoutConfiguration = new TenacityConfiguration();
            timeoutConfiguration.setExecutionIsolationThreadTimeoutInMillis(1);
            new TenacityPropertyRegister(
                    ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.TENACITY_AUTH_TIMEOUT, timeoutConfiguration),
                    new BreakerboxConfiguration())
            .register();

            when(mockAuthenticator.authenticate(anyString())).thenAnswer(new Answer<Void>() {
View Full Code Here

Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

        final TenacityConfiguration overrideConfiguration = new TenacityConfiguration(
                new ThreadPoolConfiguration(50, 3, 27, 57, 2000, 20),
                new CircuitBreakerConfiguration(1, 2, 3, 2000, 20),
                982);

        final TenacityPropertyRegister tenacityPropertyRegister = new TenacityPropertyRegister(
                ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.OVERRIDE, overrideConfiguration),
                new BreakerboxConfiguration(),
                mock(ArchaiusPropertyRegister.class));

        tenacityPropertyRegister.register();

        assertEquals(new TenacitySuccessCommand(DependencyKey.OVERRIDE).execute(), "value");
        assertEquals(new TenacitySuccessCommand(DependencyKey.OVERRIDE).queue().get(), "value");

        final TenacitySuccessCommand successCommand = new TenacitySuccessCommand(DependencyKey.OVERRIDE);
View Full Code Here

Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

        final TenacityConfiguration exampleConfiguration = new TenacityConfiguration(
                new ThreadPoolConfiguration(1, 1, 10, queueMaxSize, 10000, 10),
                new CircuitBreakerConfiguration(20, 5000, 50, 10000, 10),
                5000);

        final TenacityPropertyRegister tenacityPropertyRegister = new TenacityPropertyRegister(
                ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.SLEEP, exampleConfiguration),
                new BreakerboxConfiguration(),
                mock(ArchaiusPropertyRegister.class));

        tenacityPropertyRegister.register();

        final ImmutableList.Builder<Future<Optional<String>>> sleepCommands = ImmutableList.builder();
        for (int i = 0; i < queueMaxSize * 2; i++) {
            sleepCommands.add(new SleepCommand(DependencyKey.SLEEP).queue());
        }
View Full Code Here

Examples of com.yammer.tenacity.core.properties.TenacityPropertyRegister

        final ThreadPoolConfiguration poolConfig = new ThreadPoolConfiguration();
        poolConfig.setThreadPoolCoreSize(poolSize);
        final CircuitBreakerConfiguration circuitConfig = new CircuitBreakerConfiguration();
        circuitConfig.setErrorThresholdPercentage(1);
        circuitConfig.setRequestVolumeThreshold(1);
        new TenacityPropertyRegister(
                ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(
                        DependencyKey.EXAMPLE, new TenacityConfiguration(
                                poolConfig, circuitConfig, timeout
                        )
                ),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.