当前位置: 首页>>代码示例>>Java>>正文


Java BreakerboxConfiguration类代码示例

本文整理汇总了Java中com.yammer.tenacity.core.config.BreakerboxConfiguration的典型用法代码示例。如果您正苦于以下问题:Java BreakerboxConfiguration类的具体用法?Java BreakerboxConfiguration怎么用?Java BreakerboxConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BreakerboxConfiguration类属于com.yammer.tenacity.core.config包,在下文中一共展示了BreakerboxConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BreakerboxServiceConfiguration

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@JsonCreator
public BreakerboxServiceConfiguration(@JsonProperty("azure") AzureTableConfiguration azure,
                                      @JsonProperty("tenacityClient") JerseyClientConfiguration tenacityClientConfiguration,
                                      @JsonProperty("breakerboxServicesPropertyKeys") TenacityConfiguration breakerboxServicesPropertyKeys,
                                      @JsonProperty("breakerboxServicesConfiguration") TenacityConfiguration breakerboxServicesConfiguration,
                                      @JsonProperty("breakerbox") BreakerboxConfiguration breakerboxConfiguration,
                                      @JsonProperty("ldap") LdapConfiguration ldapConfiguration,
                                      @JsonProperty("archaiusOverride") ArchaiusOverrideConfiguration archaiusOverride,
                                      @JsonProperty("database") JdbiConfiguration jdbiConfiguration,
                                      @JsonProperty("breakerboxHostAndPort") HostAndPort breakerboxHostAndPort,
                                      @JsonProperty("defaultDashboard") String defaultDashboard) {
    this.azure = Optional.fromNullable(azure);
    this.tenacityClient = tenacityClientConfiguration;
    this.breakerboxServicesPropertyKeys = Optional.fromNullable(breakerboxServicesPropertyKeys).or(new TenacityConfiguration());
    this.breakerboxServicesConfiguration = Optional.fromNullable(breakerboxServicesConfiguration).or(new TenacityConfiguration());
    this.breakerboxConfiguration = breakerboxConfiguration;
    this.ldapConfiguration = Optional.fromNullable(ldapConfiguration);
    this.archaiusOverride = Optional.fromNullable(archaiusOverride).or(new ArchaiusOverrideConfiguration());
    this.jdbiConfiguration = Optional.fromNullable(jdbiConfiguration);
    this.breakerboxHostAndPort = Optional.fromNullable(breakerboxHostAndPort).or(HostAndPort.fromParts("localhost", 20040));
    this.defaultDashboard = Optional.fromNullable(defaultDashboard).or("production");
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:23,代码来源:BreakerboxServiceConfiguration.java

示例2: executionIsolationStrategyCanBeChangedAtAnyTime

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test
public void executionIsolationStrategyCanBeChangedAtAnyTime() {
    final RandomTenacityKey randomTenacityKey = new RandomTenacityKey(UUID.randomUUID().toString());
    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionIsolationStrategy().get())
            .isEqualTo(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD);

    new TenacityPropertyRegister(ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(
            randomTenacityKey, new TenacityConfiguration()), new BreakerboxConfiguration()).register();

    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionIsolationStrategy().get())
            .isEqualTo(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD);

    final TenacityConfiguration semaphoreConfiguration = new TenacityConfiguration();
    semaphoreConfiguration.setExecutionIsolationThreadTimeoutInMillis(912);
    semaphoreConfiguration.setExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);

    new TenacityPropertyRegister(ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(
            randomTenacityKey, semaphoreConfiguration), new BreakerboxConfiguration()).register();

    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionTimeoutInMilliseconds().get())
            .isEqualTo(semaphoreConfiguration.getExecutionIsolationThreadTimeoutInMillis());
    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionIsolationStrategy().get())
            .isEqualTo(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:25,代码来源:TenacityObservableCommandTest.java

示例3: shouldThrowWhenAuthenticateTimesOut

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test(expected = HystrixRuntimeException.class)
public void shouldThrowWhenAuthenticateTimesOut() throws AuthenticationException {
    final TenacityConfiguration overrideConfiguration = new TenacityConfiguration();
    overrideConfiguration.setExecutionIsolationThreadTimeoutInMillis(1);

    new TenacityPropertyRegister(
            ImmutableMap.of(DependencyKey.TENACITY_AUTH_TIMEOUT, overrideConfiguration),
            new BreakerboxConfiguration(),
            mock(ArchaiusPropertyRegister.class))
            .register();

    when(mockAuthenticator.authenticate(any(BasicCredentials.class))).thenAnswer((invocation) -> {
        Thread.sleep(50);
        return new Object();
    });

    try {
        assertThat(tenacityAuthenticator.authenticate(new BasicCredentials("credentials", "credentials")))
                .isEqualTo(Optional.empty());
    } catch (HystrixRuntimeException err) {
        assertThat(err.getFailureType()).isEqualTo(HystrixRuntimeException.FailureType.TIMEOUT);
        throw err;
    }
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:25,代码来源:TenacityAuthenticatorTest.java

示例4: BreakerboxServiceConfiguration

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@JsonCreator
public BreakerboxServiceConfiguration(@JsonProperty("azure") AzureTableConfiguration azure,
                                      @JsonProperty("tenacityClient") JerseyClientConfiguration tenacityClientConfiguration,
                                      @JsonProperty("breakerboxServicesPropertyKeys") TenacityConfiguration breakerboxServicesPropertyKeys,
                                      @JsonProperty("breakerboxServicesConfiguration") TenacityConfiguration breakerboxServicesConfiguration,
                                      @JsonProperty("breakerbox") BreakerboxConfiguration breakerboxConfiguration,
                                      @JsonProperty("ldap") LdapConfiguration ldapConfiguration,
                                      @JsonProperty("archaiusOverride") ArchaiusOverrideConfiguration archaiusOverride,
                                      @JsonProperty("database") JdbiConfiguration jdbiConfiguration,
                                      @JsonProperty("breakerboxHostAndPort") HostAndPort breakerboxHostAndPort,
                                      @JsonProperty("defaultDashboard") String defaultDashboard,
                                      @JsonProperty("turbine") Path turbine,
                                      @JsonProperty("instanceDiscoveryClass") String instanceDiscoveryClass,
                                      @JsonProperty("hystrixStreamSuffix") String hystrixStreamSuffix,
                                      @JsonProperty("rancherDiscovery") RancherInstanceConfiguration rancherInstanceConfiguration,
                                      @JsonProperty("marathonDiscovery")List<MarathonClientConfiguration> marathonClientConfiguration) {
    this.azure = Optional.ofNullable(azure);
    this.tenacityClient = tenacityClientConfiguration;
    this.breakerboxServicesPropertyKeys = Optional.ofNullable(breakerboxServicesPropertyKeys).orElse(new TenacityConfiguration());
    this.breakerboxServicesConfiguration = Optional.ofNullable(breakerboxServicesConfiguration).orElse(new TenacityConfiguration());
    this.breakerboxConfiguration = breakerboxConfiguration;
    this.ldapConfiguration = Optional.ofNullable(ldapConfiguration);
    this.archaiusOverride = Optional.ofNullable(archaiusOverride).orElse(new ArchaiusOverrideConfiguration());
    this.jdbiConfiguration = Optional.ofNullable(jdbiConfiguration);
    this.breakerboxHostAndPort = Optional.ofNullable(breakerboxHostAndPort).orElse(HostAndPort.fromParts("localhost", 8080));
    this.defaultDashboard = Optional.ofNullable(defaultDashboard).orElse("production");
    this.turbine = Optional.ofNullable(turbine).orElse(Paths.get("breakerbox-instances.yml"));
    this.instanceDiscoveryClass = Objects.isNull(instanceDiscoveryClass) ? Optional.ofNullable(System.getProperty("InstanceDiscovery.impl")) : Optional.of(instanceDiscoveryClass);
    this.hystrixStreamSuffix = Optional.ofNullable(hystrixStreamSuffix);
    this.rancherInstanceConfiguration = Optional.ofNullable(rancherInstanceConfiguration);
    this.marathonClientConfiguration = Optional.ofNullable(marathonClientConfiguration);
}
 
开发者ID:yammer,项目名称:breakerbox,代码行数:33,代码来源:BreakerboxServiceConfiguration.java

示例5: TenacityPropertyRegister

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
public TenacityPropertyRegister(Map<TenacityPropertyKey, TenacityConfiguration> configurations,
                                BreakerboxConfiguration breakerboxConfiguration,
                                ArchaiusPropertyRegister archaiusPropertyRegister) {
    this.configurations = ImmutableMap.copyOf(configurations);
    this.breakerboxConfiguration = breakerboxConfiguration;
    this.archaiusPropertyRegister = archaiusPropertyRegister;
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:8,代码来源:TenacityPropertyRegister.java

示例6: register

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
public void register(BreakerboxConfiguration breakerboxConfiguration) {
    if (breakerboxConfiguration.getUrls().isEmpty()) {
        return;
    }

    final TenacityPollingScheduler tenacityPollingScheduler = new TenacityPollingScheduler(
            Ints.checkedCast(breakerboxConfiguration.getInitialDelay().toMilliseconds()),
            Ints.checkedCast(breakerboxConfiguration.getDelay().toMilliseconds()),
            true);

    final CountDownLatch countDownLatch = new CountDownLatch(1);

    if (breakerboxConfiguration.isWaitForInitialLoad()) {
        tenacityPollingScheduler.addPollListener((eventType, lastResult, exception) -> countDownLatch.countDown());
    }

    final DynamicConfiguration dynConfig = new DynamicConfiguration(
            new URLConfigurationSource(breakerboxConfiguration.getUrls().split(",")),
            tenacityPollingScheduler);

    ConfigurationManager.getConfigInstance();
    ConfigurationManager.loadPropertiesFromConfiguration(dynConfig);

    if (breakerboxConfiguration.isWaitForInitialLoad()) {
        final Duration duration = breakerboxConfiguration.getWaitForInitialLoad();
        try {
            final boolean success = countDownLatch.await(duration.getQuantity(), duration.getUnit());
            LOGGER.info("Breakerbox initial configuration load: {}", success ? "SUCCESS" : "FAILURE");
        } catch (Exception err) {
            LOGGER.warn("Failed waiting for Breakerbox initial load", err);
        }
    }
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:34,代码来源:ArchaiusPropertyRegister.java

示例7: exceptionsShouldMapTimeouts

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test
public void exceptionsShouldMapTimeouts() throws AuthenticationException {
    Optional<Integer> responseStatus;
    try {
        final TenacityConfiguration timeoutConfiguration = new TenacityConfiguration();
        timeoutConfiguration.setExecutionIsolationThreadTimeoutInMillis(1);
        new TenacityPropertyRegister(
                ImmutableMap.of(DependencyKey.TENACITY_AUTH_TIMEOUT, timeoutConfiguration),
                new BreakerboxConfiguration())
                .register();

        when(mockAuthenticator.authenticate(anyString())).thenAnswer((invocation) -> {
            Thread.sleep(100);
            return Optional.empty();
        });

        final Response response = resources.client()
                .target("/")
                .request()
                .header(HttpHeaders.AUTHORIZATION, "Bearer TEST")
                .get(Response.class);
        responseStatus = Optional.of(response.getStatus());
    } catch (ResponseProcessingException err) {
        responseStatus = Optional.of(err.getResponse().getStatus());
    }
    assertThat(responseStatus).contains(statusCode);
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:28,代码来源:TenacityContainerExceptionMapperTest.java

示例8: shouldTimeoutAndRespectsKeyProperties

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test
public void shouldTimeoutAndRespectsKeyProperties() throws InterruptedException {
    final TenacityConfiguration tenacityConfiguration = new TenacityConfiguration();
    tenacityConfiguration.setExecutionIsolationThreadTimeoutInMillis(100);

    new TenacityPropertyRegister(
            ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.OBSERVABLE_TIMEOUT, tenacityConfiguration),
            new BreakerboxConfiguration())
            .register();

    executeTimeoutAndVerify(new TimeoutObservable(Duration.milliseconds(300)));
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:13,代码来源:TenacityObservableCommandTest.java

示例9: shouldNotTimeoutAndRespectsProperties

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test
public void shouldNotTimeoutAndRespectsProperties() {
    final TenacityConfiguration tenacityConfiguration = new TenacityConfiguration();
    tenacityConfiguration.setExecutionIsolationThreadTimeoutInMillis(2000);

    new TenacityPropertyRegister(
            ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.OBSERVABLE_TIMEOUT, tenacityConfiguration),
            new BreakerboxConfiguration())
            .register();
    final TenacityObservableCommand<Boolean> command = new TimeoutObservable(Duration.milliseconds(1250));
    assertTrue(command.toObservable().toBlocking().single());
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:13,代码来源:TenacityObservableCommandTest.java

示例10: executionIsolationStrategyCanByChangedByRegister

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Test
public void executionIsolationStrategyCanByChangedByRegister() {
    final RandomTenacityKey randomTenacityKey = new RandomTenacityKey(UUID.randomUUID().toString());
    final TenacityConfiguration semaphoreConfiguration = new TenacityConfiguration();
    semaphoreConfiguration.setExecutionIsolationThreadTimeoutInMillis(912);
    semaphoreConfiguration.setExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);

    new TenacityPropertyRegister(ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(
                    randomTenacityKey, semaphoreConfiguration), new BreakerboxConfiguration()).register();

    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionTimeoutInMilliseconds().get())
            .isEqualTo(semaphoreConfiguration.getExecutionIsolationThreadTimeoutInMillis());
    assertThat(TenacityObservableCommand.getCommandProperties(randomTenacityKey).executionIsolationStrategy().get())
            .isEqualTo(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE);
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:16,代码来源:TenacityObservableCommandTest.java

示例11: registerTenacityProperties

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
private void registerTenacityProperties() {
    new TenacityPropertyRegister(
            ImmutableMap.<TenacityPropertyKey, TenacityConfiguration>of(DependencyKey.CLIENT_TIMEOUT, tenacityConfiguration),
            new BreakerboxConfiguration(),
            mock(ArchaiusPropertyRegister.class))
            .register();
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:8,代码来源:ClientTimeoutTest.java

示例12: getBreakerboxConfiguration

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
public BreakerboxConfiguration getBreakerboxConfiguration() {
    return breakerboxConfiguration;
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:4,代码来源:LogProducerConfiguration.java

示例13: getBreakerboxConfiguration

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Override
public BreakerboxConfiguration getBreakerboxConfiguration(LogProducerConfiguration configuration) {
    return configuration.getBreakerboxConfiguration();
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:5,代码来源:LogProducerTenacityBundleConfigurationFactory.java

示例14: getBreakerboxConfiguration

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
@Override
public BreakerboxConfiguration getBreakerboxConfiguration(T applicationConfiguration) {
    return new BreakerboxConfiguration();
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:5,代码来源:BaseTenacityBundleConfigurationFactory.java

示例15: getBreakerbox

import com.yammer.tenacity.core.config.BreakerboxConfiguration; //导入依赖的package包/类
public BreakerboxConfiguration getBreakerbox() {
    return breakerbox;
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:4,代码来源:ArchaiusPropertyRegisterBlockStartupTest.java


注:本文中的com.yammer.tenacity.core.config.BreakerboxConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。