├── gradle.properties ├── OSSMETADATA ├── hystrix-dashboard ├── src │ └── main │ │ ├── webapp │ │ ├── css │ │ │ ├── simplegrid │ │ │ │ ├── README.txt │ │ │ │ ├── 1236_grid.css │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── 986_grid.css │ │ │ │ └── percentage_grid.css │ │ │ └── global.css │ │ ├── images │ │ │ ├── hystrix-logo.png │ │ │ └── hystrix-logo-tagline-tiny.png │ │ ├── components │ │ │ ├── hystrixCommand │ │ │ │ ├── magnifying-glass-icon.png │ │ │ │ ├── magnifying-glass-icon-20.png │ │ │ │ └── templates │ │ │ │ │ └── hystrixCircuitProperties.html │ │ │ └── hystrixThreadPool │ │ │ │ └── templates │ │ │ │ ├── hystrixThreadPool.html │ │ │ │ └── hystrixThreadPoolContainer.html │ │ ├── index.css │ │ ├── WEB-INF │ │ │ ├── classes │ │ │ │ └── log4j.properties │ │ │ └── web.xml │ │ ├── js │ │ │ ├── LICENSE │ │ │ ├── tmpl.js │ │ │ └── jquery.tinysort.min.js │ │ └── monitor │ │ │ └── monitor.css │ │ ├── test │ │ └── com │ │ │ └── netflix │ │ │ └── hystrix │ │ │ └── dashboard │ │ │ └── stream │ │ │ └── UrlUtilsTest.java │ │ └── java │ │ └── com │ │ └── netflix │ │ └── hystrix │ │ └── dashboard │ │ └── stream │ │ ├── UrlUtils.java │ │ └── EurekaInfoServlet.java ├── build.gradle └── README.md ├── gradle ├── doclet-exclude.jar └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .travis.yml ├── hystrix-core ├── src │ ├── test │ │ ├── resources │ │ │ └── FAKE_META_INF_SERVICES │ │ │ │ ├── com.netflix.hystrix.strategy.properties.HystrixDynamicPropertiesFail │ │ │ │ └── com.netflix.hystrix.strategy.properties.HystrixDynamicProperties │ │ └── java │ │ │ └── com │ │ │ └── netflix │ │ │ └── hystrix │ │ │ ├── NotWrappedByHystrixTestException.java │ │ │ ├── NotWrappedByHystrixTestRuntimeException.java │ │ │ └── util │ │ │ └── ExceptionsTest.java │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── netflix │ │ │ └── hystrix │ │ │ ├── exception │ │ │ ├── ExceptionNotWrappedByHystrix.java │ │ │ ├── package-info.java │ │ │ ├── HystrixTimeoutException.java │ │ │ └── HystrixBadRequestException.java │ │ │ ├── util │ │ │ ├── Exceptions.java │ │ │ ├── package-info.java │ │ │ ├── ExceptionThreadingUtility.java │ │ │ └── InternMap.java │ │ │ ├── strategy │ │ │ ├── package-info.java │ │ │ ├── executionhook │ │ │ │ ├── package-info.java │ │ │ │ └── HystrixCommandExecutionHookDefault.java │ │ │ ├── eventnotifier │ │ │ │ ├── package-info.java │ │ │ │ └── HystrixEventNotifierDefault.java │ │ │ ├── metrics │ │ │ │ ├── package-info.java │ │ │ │ ├── HystrixMetricsPublisherDefault.java │ │ │ │ ├── HystrixMetricsPublisherCollapserDefault.java │ │ │ │ ├── HystrixMetricsPublisherThreadPoolDefault.java │ │ │ │ ├── HystrixMetricsPublisherCommandDefault.java │ │ │ │ ├── HystrixMetricsPublisherCommand.java │ │ │ │ ├── HystrixMetricsPublisherCollapser.java │ │ │ │ └── HystrixMetricsPublisherThreadPool.java │ │ │ ├── properties │ │ │ │ ├── package-info.java │ │ │ │ ├── HystrixPropertiesTimerThreadPoolDefault.java │ │ │ │ ├── HystrixPropertiesCommandDefault.java │ │ │ │ ├── HystrixPropertiesStrategyDefault.java │ │ │ │ ├── HystrixPropertiesThreadPoolDefault.java │ │ │ │ ├── HystrixPropertiesCollapserDefault.java │ │ │ │ └── HystrixDynamicProperty.java │ │ │ └── concurrency │ │ │ │ ├── package-info.java │ │ │ │ ├── HystrixConcurrencyStrategyDefault.java │ │ │ │ ├── HystrixRequestVariable.java │ │ │ │ └── HystrixRequestVariableLifecycle.java │ │ │ ├── HystrixInvokable.java │ │ │ ├── package-info.java │ │ │ ├── collapser │ │ │ ├── README.txt │ │ │ ├── CollapserTimer.java │ │ │ ├── RealCollapserTimer.java │ │ │ └── HystrixCollapserBridge.java │ │ │ ├── HystrixKey.java │ │ │ ├── metric │ │ │ ├── HystrixEvent.java │ │ │ ├── HystrixEventStream.java │ │ │ └── sample │ │ │ │ ├── HystrixCommandUtilization.java │ │ │ │ └── HystrixUtilization.java │ │ │ ├── HystrixCachedObservable.java │ │ │ └── HystrixMetrics.java │ └── jmh │ │ └── java │ │ └── com │ │ └── netflix │ │ └── hystrix │ │ └── perf │ │ └── CommandConstructionPerfTest.java └── build.gradle ├── hystrix-contrib ├── hystrix-junit │ ├── build.gradle │ └── src │ │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── hystrix │ │ │ └── junit │ │ │ └── HystrixRequestContextRuleTest.java │ │ └── main │ │ └── java │ │ └── com │ │ └── hystrix │ │ └── junit │ │ └── HystrixRequestContextRule.java ├── hystrix-request-servlet │ └── build.gradle ├── hystrix-yammer-metrics-publisher │ ├── build.gradle │ └── README.md ├── hystrix-metrics-event-stream-jaxrs │ ├── src │ │ ├── test │ │ │ ├── resources │ │ │ │ └── test.properties │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── netflix │ │ │ │ └── hystrix │ │ │ │ └── contrib │ │ │ │ └── metrics │ │ │ │ └── controller │ │ │ │ ├── HystrixConfigControllerTest.java │ │ │ │ └── HystrixUtilizationControllerTest.java │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── netflix │ │ │ └── hystrix │ │ │ └── contrib │ │ │ └── metrics │ │ │ ├── HystrixStream.java │ │ │ └── HystrixStreamFeature.java │ └── build.gradle ├── hystrix-servo-metrics-publisher │ └── build.gradle ├── hystrix-codahale-metrics-publisher │ ├── build.gradle │ ├── README.md │ └── src │ │ └── test │ │ └── java │ │ └── com │ │ └── netflix │ │ └── hystrix │ │ └── contrib │ │ └── codahalemetricspublisher │ │ └── HystrixCodaHaleMetricsPublisherCommandTest.java ├── hystrix-javanica │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── netflix │ │ │ │ └── hystrix │ │ │ │ └── contrib │ │ │ │ └── javanica │ │ │ │ ├── annotation │ │ │ │ ├── HystrixException.java │ │ │ │ ├── HystrixProperty.java │ │ │ │ └── ObservableExecutionMode.java │ │ │ │ ├── aop │ │ │ │ └── aspectj │ │ │ │ │ └── WeavingMode.java │ │ │ │ ├── command │ │ │ │ ├── ClosureCommand.java │ │ │ │ ├── closure │ │ │ │ │ ├── ClosureFactory.java │ │ │ │ │ ├── Closure.java │ │ │ │ │ └── AsyncClosureFactory.java │ │ │ │ ├── ExecutionType.java │ │ │ │ └── CommandAction.java │ │ │ │ ├── exception │ │ │ │ ├── HystrixPropertyException.java │ │ │ │ ├── FallbackInvocationException.java │ │ │ │ ├── FallbackDefinitionException.java │ │ │ │ ├── HystrixCachingException.java │ │ │ │ ├── CommandActionExecutionException.java │ │ │ │ └── HystrixCacheKeyGenerationException.java │ │ │ │ ├── cache │ │ │ │ ├── HystrixGeneratedCacheKey.java │ │ │ │ ├── DefaultHystrixGeneratedCacheKey.java │ │ │ │ └── annotation │ │ │ │ │ └── CacheKey.java │ │ │ │ └── utils │ │ │ │ ├── EnvUtils.java │ │ │ │ └── CommonUtils.java │ │ └── resources │ │ │ └── dummy.txt │ │ ├── test │ │ ├── resources │ │ │ ├── dummy.txt │ │ │ └── log4j.properties │ │ └── java │ │ │ └── com │ │ │ └── netflix │ │ │ └── hystrix │ │ │ └── contrib │ │ │ └── javanica │ │ │ ├── util │ │ │ ├── bridge │ │ │ │ ├── Parent.java │ │ │ │ ├── Child.java │ │ │ │ ├── SubChild.java │ │ │ │ ├── GenericInterface.java │ │ │ │ └── GenericInterfaceImpl.java │ │ │ └── GetMethodTest.java │ │ │ └── test │ │ │ ├── common │ │ │ └── domain │ │ │ │ ├── Domain.java │ │ │ │ └── Profile.java │ │ │ └── spring │ │ │ ├── fallback │ │ │ ├── GenericFallbackTest.java │ │ │ ├── InheritedFallbackTest.java │ │ │ └── DefaultFallbackTest.java │ │ │ ├── conf │ │ │ ├── AopJdkConfig.java │ │ │ ├── AopCglibConfig.java │ │ │ ├── AopLoadTimeWeavingConfig.java │ │ │ └── SpringApplicationContext.java │ │ │ ├── command │ │ │ ├── jdk │ │ │ │ └── CommandJdkProxyTest.java │ │ │ └── cglib │ │ │ │ └── CommandCGlibProxyTest.java │ │ │ ├── configuration │ │ │ ├── fallback │ │ │ │ └── FallbackDefaultPropertiesTest.java │ │ │ ├── command │ │ │ │ ├── CommandDefaultPropertiesTest.java │ │ │ │ └── CommandPropertiesTest.java │ │ │ └── collapser │ │ │ │ └── CollapserPropertiesTest.java │ │ │ └── error │ │ │ ├── DefaultIgnoreExceptionsTest.java │ │ │ └── DefaultRaiseHystrixExceptionsTest.java │ │ └── ajcTest │ │ ├── resources │ │ ├── dummy.txt │ │ └── log4j.properties │ │ └── java │ │ └── com │ │ └── netflix │ │ └── hystrix │ │ └── contrib │ │ └── javanica │ │ └── test │ │ └── aspectj │ │ ├── collapser │ │ └── CollapserTest.java │ │ ├── observable │ │ └── ObservableTest.java │ │ ├── fallback │ │ └── CommandFallbackTest.java │ │ ├── error │ │ ├── ErrorPropagationTest.java │ │ └── ObservableErrorPropagationTest.java │ │ ├── cache │ │ └── CacheTest.java │ │ ├── configuration │ │ ├── command │ │ │ └── CommandPropertiesTest.java │ │ └── collapser │ │ │ └── CollapserPropertiesTest.java │ │ └── command │ │ └── CommandTest.java ├── hystrix-metrics-event-stream │ └── build.gradle ├── hystrix-rx-netty-metrics-stream │ └── build.gradle ├── hystrix-network-auditor-agent │ └── build.gradle ├── README.md └── hystrix-clj │ ├── README.md │ └── build.gradle ├── hystrix-examples-webapp ├── src │ └── main │ │ └── webapp │ │ └── WEB-INF │ │ └── classes │ │ └── log4j.properties ├── build.gradle └── README.md ├── hystrix-examples ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── netflix │ └── hystrix │ └── examples │ └── demo │ ├── Order.java │ ├── PaymentInformation.java │ └── UserAccount.java ├── hystrix-serialization ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── netflix │ └── hystrix │ └── serial │ └── SerialHystrixMetric.java ├── .gitignore ├── CONTRIBUTING.md └── settings.gradle /gradle.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OSSMETADATA: -------------------------------------------------------------------------------- 1 | osslifecycle=active 2 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/simplegrid/README.txt: -------------------------------------------------------------------------------- 1 | http://simplegrid.info/ -------------------------------------------------------------------------------- /gradle/doclet-exclude.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/gradle/doclet-exclude.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | sudo: false 3 | 4 | jdk: 5 | - oraclejdk8 6 | 7 | script: 8 | - ./gradlew --info check -------------------------------------------------------------------------------- /hystrix-core/src/test/resources/FAKE_META_INF_SERVICES/com.netflix.hystrix.strategy.properties.HystrixDynamicPropertiesFail: -------------------------------------------------------------------------------- 1 | FAILDONOTWORK -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-junit/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compileApi "junit:junit:4.11" 4 | } 5 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/images/hystrix-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/hystrix-dashboard/src/main/webapp/images/hystrix-logo.png -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-request-servlet/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | provided 'javax.servlet:servlet-api:2.5' 4 | } 5 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-yammer-metrics-publisher/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compileApi 'com.yammer.metrics:metrics-core:2.2.0' 4 | } 5 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/images/hystrix-logo-tagline-tiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/hystrix-dashboard/src/main/webapp/images/hystrix-logo-tagline-tiny.png -------------------------------------------------------------------------------- /hystrix-core/src/test/resources/FAKE_META_INF_SERVICES/com.netflix.hystrix.strategy.properties.HystrixDynamicProperties: -------------------------------------------------------------------------------- 1 | com.netflix.hystrix.strategy.HystrixPluginsTest$MockHystrixDynamicPropertiesTest -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/components/hystrixCommand/magnifying-glass-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/hystrix-dashboard/src/main/webapp/components/hystrixCommand/magnifying-glass-icon.png -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/components/hystrixCommand/magnifying-glass-icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/biubiu/Hystrix/master/hystrix-dashboard/src/main/webapp/components/hystrixCommand/magnifying-glass-icon-20.png -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/resources/test.properties: -------------------------------------------------------------------------------- 1 | hystrix.stream.utilization.intervalInMilliseconds=10 2 | hystrix.stream.dashboard.intervalInMilliseconds=10 3 | hystrix.stream.config.intervalInMilliseconds=10 -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-servo-metrics-publisher/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compileApi 'com.netflix.servo:servo-core:0.10.1' 4 | testCompile 'junit:junit-dep:4.10' 5 | testCompile 'org.mockito:mockito-all:1.9.5' 6 | } 7 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-codahale-metrics-publisher/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compileApi 'io.dropwizard.metrics:metrics-core:3.2.2' 4 | testCompile 'junit:junit-dep:4.10' 5 | testCompile 'org.mockito:mockito-all:1.9.5' 6 | } 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 19 16:56:49 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip 7 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/annotation/HystrixException.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.annotation; 2 | 3 | /** 4 | * Created by Mike Cowan 5 | */ 6 | public enum HystrixException { 7 | RUNTIME_EXCEPTION, 8 | } 9 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compile project(':hystrix-serialization') 4 | provided 'javax.servlet:servlet-api:2.5' 5 | testCompile 'junit:junit-dep:4.10' 6 | testCompile 'org.mockito:mockito-all:1.9.5' 7 | } 8 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/index.css: -------------------------------------------------------------------------------- 1 | table { 2 | width: 100%; 3 | border-collapse: collapse; 4 | } 5 | 6 | table, td { 7 | border: 1px solid #DBDBDB; 8 | } 9 | 10 | table tr:nth-child(even) { 11 | background-color: #ECECEC; 12 | } 13 | 14 | table tr:nth-child(odd) { 15 | background-color: #FFFFFF; 16 | } 17 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/exception/ExceptionNotWrappedByHystrix.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.exception; 2 | 3 | /** 4 | * Exceptions can implement this interface to prevent Hystrix from wrapping detected exceptions in a HystrixRuntimeException 5 | */ 6 | public interface ExceptionNotWrappedByHystrix { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, FILE 2 | log4j.appender.FILE=org.apache.log4j.ConsoleAppender 3 | log4j.appender.FILE.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %C:%L [%C{1}] [%M]: %m%n 5 | 6 | log4j.appender.FILE.httpclient=ERROR 7 | -------------------------------------------------------------------------------- /hystrix-examples-webapp/src/main/webapp/WEB-INF/classes/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, FILE 2 | log4j.appender.FILE=org.apache.log4j.ConsoleAppender 3 | log4j.appender.FILE.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %C:%L [%C{1}] [%M]: %m%n 5 | 6 | log4j.appender.FILE.httpclient=ERROR 7 | -------------------------------------------------------------------------------- /hystrix-core/src/test/java/com/netflix/hystrix/NotWrappedByHystrixTestException.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix; 2 | 3 | import com.netflix.hystrix.exception.ExceptionNotWrappedByHystrix; 4 | 5 | public class NotWrappedByHystrixTestException extends Exception implements ExceptionNotWrappedByHystrix { 6 | private static final long serialVersionUID = 1L; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-rx-netty-metrics-stream/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compile project(':hystrix-serialization') 4 | compileApi 'io.reactivex:rxnetty:0.4.17' 5 | testCompile 'junit:junit-dep:4.10' 6 | testCompile 'org.powermock:powermock-easymock-release-full:1.5.5' 7 | testCompile 'org.easymock:easymock:3.2' 8 | } 9 | -------------------------------------------------------------------------------- /hystrix-core/src/test/java/com/netflix/hystrix/NotWrappedByHystrixTestRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix; 2 | 3 | import com.netflix.hystrix.exception.ExceptionNotWrappedByHystrix; 4 | 5 | public class NotWrappedByHystrixTestRuntimeException extends RuntimeException implements ExceptionNotWrappedByHystrix { 6 | private static final long serialVersionUID = 1L; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/components/hystrixCommand/templates/hystrixCircuitProperties.html: -------------------------------------------------------------------------------- 1 |
2 |
Median
3 |
<%= sla_medianLastMinute %>ms
4 |
99th
5 |
<%= sla_percentile99LastMinute %>ms
6 |
7 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi project(':hystrix-core') 3 | compile project(':hystrix-serialization') 4 | provided 'javax.ws.rs:javax.ws.rs-api:2.0.1' 5 | testCompile 'junit:junit-dep:4.10' 6 | testCompile 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:2.25.1' 7 | testCompile 'org.glassfish.jersey.media:jersey-media-sse:2.25.1' 8 | 9 | } 10 | -------------------------------------------------------------------------------- /hystrix-examples-webapp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' 3 | 4 | dependencies { 5 | compileApi project(':hystrix-core') 6 | compileApi project(':hystrix-examples') 7 | compileApi project(':hystrix-request-servlet') 8 | compileApi project(':hystrix-metrics-event-stream') 9 | } 10 | 11 | gretty { 12 | httpPort = 8989 13 | servletContainer = 'jetty9' 14 | } 15 | -------------------------------------------------------------------------------- /hystrix-dashboard/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' 3 | 4 | dependencies { 5 | provided 'javax.servlet:servlet-api:2.5' 6 | compile 'org.apache.httpcomponents:httpclient:4.2.1' 7 | compile 'log4j:log4j:1.2.17' 8 | compile 'org.slf4j:slf4j-log4j12:1.7.0' 9 | compile 'commons-io:commons-io:2.5' 10 | testCompile 'junit:junit:4.12' 11 | } 12 | 13 | gretty { 14 | httpPort = 7979 15 | servletContainer = 'jetty9' 16 | } 17 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/util/Exceptions.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.util; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | public class Exceptions { 7 | private Exceptions() { 8 | } 9 | 10 | /** 11 | * Throws the argument, return-type is RuntimeException so the caller can use a throw statement break out of the method 12 | */ 13 | public static RuntimeException sneakyThrow(Throwable t) { 14 | return Exceptions.doThrow(t); 15 | } 16 | 17 | private static T doThrow(Throwable ex) throws T { 18 | throw (T) ex; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /hystrix-core/src/test/java/com/netflix/hystrix/util/ExceptionsTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.util; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | 8 | import static org.junit.Assert.assertTrue; 9 | import static org.junit.Assert.fail; 10 | 11 | public class ExceptionsTest { 12 | 13 | @Test 14 | public void testCastOfException(){ 15 | Exception exception = new IOException("simulated checked exception message"); 16 | try{ 17 | Exceptions.sneakyThrow(exception); 18 | fail(); 19 | } catch(Exception e){ 20 | assertTrue(e instanceof IOException); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hystrix-examples/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'osgi' 2 | 3 | dependencies { 4 | compileApi project(':hystrix-core') 5 | provided 'junit:junit-dep:4.10' 6 | } 7 | 8 | task(runDemo, dependsOn: 'classes', type: JavaExec) { 9 | main = 'com.netflix.hystrix.examples.demo.HystrixCommandDemo' 10 | classpath = sourceSets.main.runtimeClasspath 11 | } 12 | 13 | jar { 14 | manifest { 15 | name = 'hystrix-examples' 16 | instruction 'Bundle-Vendor', 'Netflix' 17 | instruction 'Bundle-DocURL', 'https://github.com/Netflix/Hystrix' 18 | instruction 'Import-Package', '!org.junit,!junit.framework,!org.mockito.*,*' 19 | instruction 'Eclipse-ExtensibleAPI', 'true' 20 | } 21 | } -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/resources/dummy.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright 2016 Netflix, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | ==== 16 | 17 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/resources/dummy.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright 2016 Netflix, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | ==== 16 | 17 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/resources/dummy.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright 2016 Netflix, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | ==== 16 | 17 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-junit/src/test/java/com/hystrix/junit/HystrixRequestContextRuleTest.java: -------------------------------------------------------------------------------- 1 | package com.hystrix.junit; 2 | 3 | import org.hamcrest.CoreMatchers; 4 | import org.hamcrest.MatcherAssert; 5 | import org.junit.Rule; 6 | import org.junit.Test; 7 | 8 | public final class HystrixRequestContextRuleTest { 9 | @Rule 10 | public HystrixRequestContextRule request = new HystrixRequestContextRule(); 11 | 12 | @Test 13 | public void initsContext() { 14 | MatcherAssert.assertThat(this.request.context(), CoreMatchers.notNullValue()); 15 | } 16 | 17 | @Test 18 | public void manuallyShutdownContextDontBreak() { 19 | this.request.after(); 20 | this.request.after(); 21 | MatcherAssert.assertThat(this.request.context(), CoreMatchers.nullValue()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-network-auditor-agent/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileApi 'org.javassist:javassist:3.19+' 3 | 4 | jar { 5 | // make a fatjar otherwise it's painful getting the boot-class-path correct when deploying 6 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 7 | manifest { 8 | attributes( 9 | "Agent-Class": "com.netflix.hystrix.contrib.networkauditor.HystrixNetworkAuditorAgent", 10 | "Can-Redefine-Classes": true, 11 | "Can-Retransform-Classes": true, 12 | "Boot-Class-Path": "hystrix-network-auditor-agent-" + version + ".jar", 13 | "Premain-Class": "com.netflix.hystrix.contrib.networkauditor.HystrixNetworkAuditorAgent") 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Common utility classes. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.util; -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Custom exception implementations. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.exception; -------------------------------------------------------------------------------- /hystrix-serialization/build.gradle: -------------------------------------------------------------------------------- 1 | repositories { 2 | mavenCentral() 3 | jcenter() 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_1_6 7 | targetCompatibility = JavaVersion.VERSION_1_6 8 | 9 | dependencies { 10 | compileApi project(':hystrix-core') 11 | 12 | //if we bump into the the 2.8.0 series, we are forced to use Java7 13 | compileApi 'com.fasterxml.jackson.core:jackson-core:2.7.5' 14 | compileApi 'com.fasterxml.jackson.core:jackson-databind:2.7.5' 15 | compileApi 'com.fasterxml.jackson.core:jackson-annotations:2.7.5' 16 | compile 'com.fasterxml.jackson.module:jackson-module-afterburner:2.7.5' 17 | 18 | testCompile 'junit:junit-dep:4.10' 19 | testCompile 'org.mockito:mockito-all:1.9.5' 20 | testCompile project(':hystrix-core').sourceSets.test.output 21 | testCompile project(':hystrix-junit') 22 | } 23 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/bridge/Parent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.util.bridge; 17 | 18 | 19 | public class Parent { 20 | } 21 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Parent package of strategies and plugin management. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.strategy; -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/domain/Domain.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.common.domain; 17 | 18 | 19 | public class Domain { 20 | } 21 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Strategy definition for execution hook. 18 | * 19 | * @since 1.2.0 20 | */ 21 | package com.netflix.hystrix.strategy.executionhook; -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/eventnotifier/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Strategy definition for event notification. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.strategy.eventnotifier; -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/HystrixInvokable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix; 17 | 18 | /** 19 | * Marker interface for Hystrix commands that can be invoked. 20 | */ 21 | public interface HystrixInvokable { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Core functionality of Hystrix including the HystrixCommand and HystrixCollapser to be extended from. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix; -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Strategy definition for publishing metrics and default implementation. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.strategy.metrics; -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/collapser/README.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright 2016 Netflix, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | ==== 16 | 17 | This package is not part of the public API and can change at any time. Do not rely upon any classes in this package. 18 | 19 | The public API is com.netflix.hystrix.HystrixCollapser -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/HystrixKey.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix; 2 | 3 | /** 4 | * Basic class for hystrix keys 5 | */ 6 | public interface HystrixKey { 7 | /** 8 | * The word 'name' is used instead of 'key' so that Enums can implement this interface and it work natively. 9 | * 10 | * @return String 11 | */ 12 | String name(); 13 | 14 | /** 15 | * Default implementation of the interface 16 | */ 17 | abstract class HystrixKeyDefault implements HystrixKey { 18 | private final String name; 19 | 20 | public HystrixKeyDefault(String name) { 21 | this.name = name; 22 | } 23 | 24 | @Override 25 | public String name() { 26 | return name; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return name; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/metric/HystrixEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.metric; 17 | 18 | /** 19 | * Marker interface for events which may appear in an event stream 20 | */ 21 | public interface HystrixEvent { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Strategy definition for properties and configuration and default implementation. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.strategy.properties; -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/bridge/Child.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.util.bridge; 17 | 18 | /** 19 | * Created by dmgcodevil. 20 | */ 21 | public class Child extends Parent { 22 | } 23 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Strategy definition for concurrency related behavior and default implementation. 18 | * 19 | * @since 1.0.0 20 | */ 21 | package com.netflix.hystrix.strategy.concurrency; -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/bridge/SubChild.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.util.bridge; 17 | 18 | /** 19 | * Created by dmgcodevil. 20 | */ 21 | public class SubChild extends Child { 22 | } 23 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/WeavingMode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.aop.aspectj; 17 | 18 | /** 19 | * Created by dmgcodevil 20 | */ 21 | public enum WeavingMode { 22 | 23 | COMPILE, RUNTIME 24 | 25 | } 26 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/bridge/GenericInterface.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.util.bridge; 17 | 18 | /** 19 | * Created by dmgcodevil 20 | */ 21 | public interface GenericInterface { 22 | 23 | 24 | R foo(P1 p1); 25 | } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | 27 | # OS generated files # 28 | ###################### 29 | .DS_Store* 30 | ehthumbs.db 31 | Icon? 32 | Thumbs.db 33 | 34 | # Editor Files # 35 | ################ 36 | *~ 37 | *.swp 38 | 39 | # Gradle Files # 40 | ################ 41 | .gradle 42 | .m2 43 | 44 | # Build output directies 45 | target/ 46 | build/ 47 | 48 | # IntelliJ specific files/directories 49 | out 50 | .idea 51 | *.ipr 52 | *.iws 53 | *.iml 54 | atlassian-ide-plugin.xml 55 | 56 | # Eclipse specific files/directories 57 | .classpath 58 | .project 59 | .settings 60 | .metadata 61 | bin/ 62 | 63 | # NetBeans specific files/directories 64 | .nbattrs 65 | -------------------------------------------------------------------------------- /hystrix-dashboard/README.md: -------------------------------------------------------------------------------- 1 | # Hystrix Dashboard 2 | 3 | View the [Dashboard Wiki](https://github.com/Netflix/Hystrix/wiki/Dashboard) for more information including installation instructions. 4 | 5 | 6 | 7 | # Run via Gradle 8 | 9 | ``` 10 | $ git clone https://github.com/Netflix/Hystrix.git 11 | $ cd Hystrix/hystrix-dashboard 12 | $ ../gradlew appRun 13 | > Building > :hystrix-dashboard:appRun > Running at http://localhost:7979/hystrix-dashboard 14 | ``` 15 | 16 | Once running, open http://localhost:7979/hystrix-dashboard. 17 | 18 | # Run as standalone Java application 19 | 20 | @kennedyoliveira has written a standalone app, documented at : https://github.com/kennedyoliveira/standalone-hystrix-dashboard 21 | 22 | # Example 23 | 24 | Example screenshot from iPad while monitoring Netflix API: 25 | 26 |

27 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/simplegrid/1236_grid.css: -------------------------------------------------------------------------------- 1 | /* SimpleGrid - a fork of CSSGrid by Crowd Favorite (https://github.com/crowdfavorite/css-grid) 2 | * http://simplegrid.info 3 | * by Conor Muirhead (http://conor.cc) of Early LLC (http://earlymade.com) 4 | * License: http://creativecommons.org/licenses/MIT/ */ 5 | 6 | /* Containers */ 7 | body { font-size: 1.125em; } 8 | .grid{ width:1206px; } 9 | 10 | /* 6-Col Grid Sizes */ 11 | .slot-0,.slot-1,.slot-2,.slot-3,.slot-4,.slot-5{ width:176px; } /* Sixths */ 12 | .slot-0-1,.slot-1-2,.slot-2-3,.slot-3-4,.slot-4-5{ width:382px; } /* Thirds */ 13 | .slot-0-1-2-3,.slot-1-2-3-4,.slot-2-3-4-5{ width:794px; } /* Two-Thirds */ 14 | .slot-0-1-2-3-4,.slot-1-2-3-4-5{ width:1000px; } /* Five-Sixths */ 15 | 16 | /* 4-Col Grid Sizes */ 17 | .slot-6,.slot-7,.slot-8,.slot-9{ width:279px; } /* Quarters */ 18 | .slot-6-7-8,.slot-7-8-9{ width:897px; } /* Three-Quarters */ 19 | 20 | /* 6-Col/4-Col Shared Grid Sizes */ 21 | .slot-0-1-2,.slot-1-2-3,.slot-2-3-4,.slot-3-4-5, .slot-6-7,.slot-7-8,.slot-8-9{ width:588px; } /* Halves */ -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapserTimer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.collapser; 17 | 18 | import java.lang.ref.Reference; 19 | 20 | import com.netflix.hystrix.util.HystrixTimer.TimerListener; 21 | 22 | /** 23 | * Timer used for trigger batch execution. 24 | */ 25 | public interface CollapserTimer { 26 | 27 | public Reference addListener(TimerListener collapseTask); 28 | } -------------------------------------------------------------------------------- /hystrix-contrib/README.md: -------------------------------------------------------------------------------- 1 | ## hystrix-contrib 2 | 3 | This is the parent of all "contrib" submodules to Hystrix. 4 | 5 | Examples of what makes sense as a contrib submodule are: 6 | 7 | - alternate implementations of [HystrixMetricsPublisher](http://netflix.github.com/Hystrix/javadoc/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.html) 8 | - alternate implementations of [HystrixPropertiesStrategy](http://netflix.github.com/Hystrix/javadoc/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategy.html) 9 | - request lifecycle implementations (such as [hystrix-request-servlet](https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-request-servlet)) 10 | - implementations of [HystrixEventNotifier](http://netflix.github.com/Hystrix/javadoc/com/netflix/hystrix/strategy/eventnotifier/HystrixEventNotifier.html) 11 | - dashboard and monitoring tools 12 | 13 | 3rd partly libraries wrapped with Hystrix do not belong here and should be their own project. 14 | 15 | They can however be referenced from the Wiki [Libraries](https://github.com/Netflix/Hystrix/wiki/Libraries) page. 16 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 Netflix, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Define the root logger with appender console 18 | log4j.rootLogger = ERROR, CONSOLE 19 | 20 | # Define the console appender 21 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 22 | log4j.appender.CONSOLE.File=${log}/log.out 23 | 24 | # Define the layout for console appender 25 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 26 | log4j.appender.CONSOLE.layout.conversionPattern=%m%n -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/domain/Profile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.common.domain; 17 | 18 | /** 19 | * Created by dmgcodevil on 1/9/2015. 20 | */ 21 | public class Profile { 22 | private String email; 23 | 24 | public String getEmail() { 25 | return email; 26 | } 27 | 28 | public void setEmail(String email) { 29 | this.email = email; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 Netflix, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Define the root logger with appender console 18 | log4j.rootLogger = ERROR, CONSOLE 19 | 20 | # Define the console appender 21 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 22 | 23 | # Define the layout for console appender 24 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 25 | log4j.appender.CONSOLE.layout.conversionPattern=%m%n 26 | 27 | log4j.logger.com.netflix.hystrix.contrib.javanica=DEBUG 28 | -------------------------------------------------------------------------------- /hystrix-examples-webapp/README.md: -------------------------------------------------------------------------------- 1 | # hystrix-examples-webapp 2 | 3 | Web application that demonstrates functionality from [hystrix-examples](https://github.com/Netflix/Hystrix/tree/master/hystrix-examples) and functionality from [hystrix-request-servlet](https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-request-servlet) and [hystrix-metrics-event-stream](https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-metrics-event-stream). 4 | 5 | The [hystrix-dashboard](https://github.com/Netflix/Hystrix/tree/master/hystrix-dashboard) can be used on this example app to monitor its metrics. 6 | 7 | # Run via Gradle 8 | 9 | ``` 10 | $ git clone git@github.com:Netflix/Hystrix.git 11 | $ cd Hystrix/hystrix-examples-webapp 12 | $ ../gradlew appRun 13 | > Building > :hystrix-examples-webapp:appRun > Running at http://localhost:8989/hystrix-examples-webapp 14 | ``` 15 | 16 | Once running, open http://localhost:8989/hystrix-examples-webapp. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/fallback/GenericFallbackTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.fallback; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.fallback.BasicGenericFallbackTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.config.AutowireCapableBeanFactory; 7 | import org.springframework.context.ApplicationContext; 8 | import org.springframework.test.context.ContextConfiguration; 9 | 10 | /** 11 | * Created by dmgcodevil. 12 | */ 13 | @ContextConfiguration(classes = {AopCglibConfig.class}) 14 | public class GenericFallbackTest extends BasicGenericFallbackTest { 15 | 16 | @Autowired 17 | private ApplicationContext applicationContext; 18 | 19 | @Override 20 | protected T createProxy(Class t) { 21 | AutowireCapableBeanFactory beanFactory = applicationContext.getAutowireCapableBeanFactory(); 22 | return beanFactory.createBean(t); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/metric/HystrixEventStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.metric; 17 | 18 | import rx.Observable; 19 | 20 | /** 21 | * Base interface for a stream of {@link com.netflix.hystrix.HystrixEventType}s. Allows consumption by individual 22 | * {@link com.netflix.hystrix.HystrixEventType} or by time-based bucketing of events 23 | */ 24 | public interface HystrixEventStream { 25 | 26 | Observable observe(); 27 | } 28 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/ClosureCommand.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command; 17 | 18 | /** 19 | * This interface is used to perform command logic within an anonymous class and basically used as wrapper for some logic. 20 | * 21 | * @param command result type 22 | */ 23 | public interface ClosureCommand { 24 | 25 | /** 26 | * Process logic. 27 | * 28 | * @return result 29 | */ 30 | T invoke(); 31 | } 32 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/conf/AopJdkConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.conf; 17 | 18 | import org.springframework.beans.factory.annotation.Configurable; 19 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 20 | import org.springframework.context.annotation.Import; 21 | 22 | @Configurable 23 | @Import(SpringApplicationContext.class) 24 | @EnableAspectJAutoProxy 25 | public class AopJdkConfig { 26 | } 27 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesTimerThreadPoolDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | import com.netflix.hystrix.HystrixTimerThreadPoolProperties; 19 | 20 | /** 21 | * Default implementation of {@link HystrixTimerThreadPoolProperties} using Archaius (https://github.com/Netflix/archaius) 22 | * 23 | * @ExcludeFromJavadoc 24 | */ 25 | public class HystrixPropertiesTimerThreadPoolDefault extends HystrixTimerThreadPoolProperties { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/simplegrid/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Crowd Favorite, Ltd. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/util/ExceptionThreadingUtility.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.util; 17 | 18 | @Deprecated 19 | public class ExceptionThreadingUtility { 20 | 21 | @Deprecated //this functionality is no longer supported 22 | public static void attachCallingThreadStack(Throwable e) { 23 | //no-op now 24 | } 25 | 26 | @Deprecated //this functionality is no longer supported 27 | public static void assignCallingThread(Thread callingThread) { 28 | //no-op now 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/util/InternMap.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.util; 2 | 3 | import java.util.concurrent.ConcurrentHashMap; 4 | import java.util.concurrent.ConcurrentMap; 5 | 6 | /** 7 | * Utility to have 'intern' - like functionality, which holds single instance of wrapper for a given key 8 | */ 9 | public class InternMap { 10 | private final ConcurrentMap storage = new ConcurrentHashMap(); 11 | private final ValueConstructor valueConstructor; 12 | 13 | public interface ValueConstructor { 14 | V create(K key); 15 | } 16 | 17 | public InternMap(ValueConstructor valueConstructor) { 18 | this.valueConstructor = valueConstructor; 19 | } 20 | 21 | public V interned(K key) { 22 | V existingKey = storage.get(key); 23 | V newKey = null; 24 | if (existingKey == null) { 25 | newKey = valueConstructor.create(key); 26 | existingKey = storage.putIfAbsent(key, newKey); 27 | } 28 | return existingKey != null ? existingKey : newKey; 29 | } 30 | 31 | public int size() { 32 | return storage.size(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/conf/AopCglibConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.conf; 17 | 18 | import org.springframework.beans.factory.annotation.Configurable; 19 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 20 | import org.springframework.context.annotation.Import; 21 | 22 | @Configurable 23 | @Import(SpringApplicationContext.class) 24 | @EnableAspectJAutoProxy(proxyTargetClass = true) 25 | public class AopCglibConfig { 26 | } 27 | -------------------------------------------------------------------------------- /hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/Order.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.examples.demo; 17 | 18 | import java.net.HttpCookie; 19 | 20 | /** 21 | * POJO 22 | */ 23 | public class Order { 24 | 25 | private final int orderId; 26 | private UserAccount user; 27 | 28 | public Order(int orderId) { 29 | this.orderId = orderId; 30 | 31 | /* a contrived example of calling GetUserAccount again */ 32 | user = new GetUserAccountCommand(new HttpCookie("mockKey", "mockValueFromHttpRequest")).execute(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/bridge/GenericInterfaceImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.util.bridge; 17 | 18 | /** 19 | * Created by dmgcodevil 20 | */ 21 | public class GenericInterfaceImpl implements GenericInterface { 22 | 23 | 24 | public Child foo(SubChild c) { 25 | return null; 26 | } 27 | 28 | @Override 29 | public Child foo(Child c) { 30 | return null; 31 | } 32 | 33 | public Child foo(Parent c) { 34 | return null; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-yammer-metrics-publisher/README.md: -------------------------------------------------------------------------------- 1 | # hystrix-yammer-metrics-publisher 2 | 3 | This is an implementation of [HystrixMetricsPublisher](http://netflix.github.com/Hystrix/javadoc/index.html?com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.html) that publishes metrics using [Yammer Metrics](http://metrics.codahale.com) version 2. If you are using Coda Hale Metrics version 3, please use the [hystrix-codahale-metrics-publisher](../hystrix-codahale-metrics-publisher) module instead. 4 | 5 | See the [Metrics & Monitoring](https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring) Wiki for more information. 6 | 7 | # Binaries 8 | 9 | Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22hystrix-yammer-metrics-publisher%22). 10 | 11 | Example for Maven: 12 | 13 | ```xml 14 | 15 | com.netflix.hystrix 16 | hystrix-yammer-metrics-publisher 17 | 1.1.2 18 | 19 | ``` 20 | 21 | and for Ivy: 22 | 23 | ```xml 24 | 25 | ``` -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/HystrixPropertyException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | /** 19 | * Created by dmgcodevil. 20 | */ 21 | public class HystrixPropertyException extends RuntimeException { 22 | 23 | public HystrixPropertyException() { 24 | } 25 | 26 | public HystrixPropertyException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public HystrixPropertyException(Throwable cause) { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystrixConfigControllerTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.metrics.controller; 17 | 18 | /** 19 | * @author justinjose28 20 | * 21 | */ 22 | public class HystrixConfigControllerTest extends HystricsMetricsControllerTest { 23 | 24 | @Override 25 | protected String getPath() { 26 | return "hystrix/config.stream"; 27 | } 28 | 29 | @Override 30 | protected boolean isStreamValid(String data) { 31 | return data.contains("\"type\":\"HystrixConfig\""); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/test/java/com/netflix/hystrix/contrib/metrics/controller/HystrixUtilizationControllerTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.metrics.controller; 17 | 18 | /** 19 | * @author justinjose28 20 | * 21 | */ 22 | public class HystrixUtilizationControllerTest extends HystricsMetricsControllerTest { 23 | 24 | @Override 25 | protected String getPath() { 26 | return "hystrix/utilization.stream"; 27 | } 28 | 29 | @Override 30 | protected boolean isStreamValid(String data) { 31 | return data.contains("\"type\":\"HystrixUtilization\""); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/test/com/netflix/hystrix/dashboard/stream/UrlUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.dashboard.stream; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * Copyright 2013 Netflix, Inc. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | /** 21 | * UrlUtilsTest unit tests 22 | * 23 | * @author diegopacheco 24 | * 25 | */ 26 | public class UrlUtilsTest { 27 | 28 | @Test(expected=IllegalArgumentException.class) 29 | public void testReadXmlInputStreamWithNull() { 30 | UrlUtils.readXmlInputStream(null); 31 | } 32 | 33 | @Test(expected=IllegalArgumentException.class) 34 | public void testReadXmlInputStreamWithBlank() { 35 | UrlUtils.readXmlInputStream(""); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/FallbackInvocationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | /** 19 | * Exception specifies error occurred in fallback method. 20 | */ 21 | public class FallbackInvocationException extends RuntimeException { 22 | 23 | public FallbackInvocationException() { 24 | } 25 | 26 | public FallbackInvocationException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public FallbackInvocationException(Throwable cause) { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Hystrix 2 | 3 | If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request. 4 | 5 | When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. 6 | 7 | ## License 8 | 9 | By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/Netflix/Hystrix/blob/master/LICENSE-2.0.txt 10 | 11 | All files are released with the Apache 2.0 license. 12 | 13 | If you are adding a new file it should have a header like this: 14 | 15 | ``` 16 | /** 17 | * Copyright 2013 Netflix, Inc. 18 | * 19 | * Licensed under the Apache License, Version 2.0 (the "License"); 20 | * you may not use this file except in compliance with the License. 21 | * You may obtain a copy of the License at 22 | * 23 | * http://www.apache.org/licenses/LICENSE-2.0 24 | * 25 | * Unless required by applicable law or agreed to in writing, software 26 | * distributed under the License is distributed on an "AS IS" BASIS, 27 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | * See the License for the specific language governing permissions and 29 | * limitations under the License. 30 | */ 31 | ``` 32 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/FallbackDefinitionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | 19 | public class FallbackDefinitionException extends RuntimeException { 20 | 21 | public FallbackDefinitionException() { 22 | } 23 | 24 | public FallbackDefinitionException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | public FallbackDefinitionException(Throwable cause) { 29 | super(cause); 30 | } 31 | 32 | public FallbackDefinitionException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/eventnotifier/HystrixEventNotifierDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.eventnotifier; 17 | 18 | 19 | /** 20 | * Default implementations of {@link HystrixEventNotifier} that does nothing. 21 | * 22 | * @ExcludeFromJavadoc 23 | */ 24 | public class HystrixEventNotifierDefault extends HystrixEventNotifier { 25 | 26 | private static HystrixEventNotifierDefault INSTANCE = new HystrixEventNotifierDefault(); 27 | 28 | private HystrixEventNotifierDefault() { 29 | 30 | } 31 | 32 | public static HystrixEventNotifier getInstance() { 33 | return INSTANCE; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesCommandDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | import com.netflix.hystrix.HystrixCommandKey; 19 | import com.netflix.hystrix.HystrixCommandProperties; 20 | 21 | /** 22 | * Default implementation of {@link HystrixCommandProperties} using Archaius (https://github.com/Netflix/archaius) 23 | * 24 | * @ExcludeFromJavadoc 25 | */ 26 | public class HystrixPropertiesCommandDefault extends HystrixCommandProperties { 27 | 28 | public HystrixPropertiesCommandDefault(HystrixCommandKey key, Setter builder) { 29 | super(key, builder); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategyDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | /** 19 | * Default implementation of {@link HystrixPropertiesStrategy}. 20 | * 21 | * @ExcludeFromJavadoc 22 | */ 23 | public class HystrixPropertiesStrategyDefault extends HystrixPropertiesStrategy { 24 | 25 | private final static HystrixPropertiesStrategyDefault INSTANCE = new HystrixPropertiesStrategyDefault(); 26 | 27 | private HystrixPropertiesStrategyDefault() { 28 | } 29 | 30 | public static HystrixPropertiesStrategy getInstance() { 31 | return INSTANCE; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/collapser/CollapserTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.collapser; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.collapser.BasicCollapserTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class CollapserTest extends BasicCollapserTest { 25 | @BeforeClass 26 | public static void setUpEnv() { 27 | System.setProperty("weavingMode", "compile"); 28 | } 29 | 30 | @Override 31 | protected UserService createUserService() { 32 | return new UserService(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesThreadPoolDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | import com.netflix.hystrix.HystrixThreadPoolKey; 19 | import com.netflix.hystrix.HystrixThreadPoolProperties; 20 | 21 | /** 22 | * Default implementation of {@link HystrixThreadPoolProperties} using Archaius (https://github.com/Netflix/archaius) 23 | * 24 | * @ExcludeFromJavadoc 25 | */ 26 | public class HystrixPropertiesThreadPoolDefault extends HystrixThreadPoolProperties { 27 | 28 | protected HystrixPropertiesThreadPoolDefault(HystrixThreadPoolKey key, Setter builder) { 29 | super(key, builder); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/conf/AopLoadTimeWeavingConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.conf; 17 | 18 | import org.springframework.beans.factory.annotation.Configurable; 19 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 20 | import org.springframework.context.annotation.EnableLoadTimeWeaving; 21 | import org.springframework.context.annotation.Import; 22 | 23 | @Configurable 24 | @Import(SpringApplicationContext.class) 25 | @EnableAspectJAutoProxy 26 | @EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.ENABLED) 27 | public class AopLoadTimeWeavingConfig { 28 | } 29 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesCollapserDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | import com.netflix.hystrix.HystrixCollapserKey; 19 | import com.netflix.hystrix.HystrixCollapserProperties; 20 | 21 | /** 22 | * Default implementation of {@link HystrixCollapserProperties} using Archaius (https://github.com/Netflix/archaius) 23 | * 24 | * @ExcludeFromJavadoc 25 | */ 26 | public class HystrixPropertiesCollapserDefault extends HystrixCollapserProperties { 27 | 28 | public HystrixPropertiesCollapserDefault(HystrixCollapserKey collapserKey, Setter builder) { 29 | super(collapserKey, builder); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/observable/ObservableTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.observable; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.observable.BasicObservableTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class ObservableTest extends BasicObservableTest { 25 | 26 | @BeforeClass 27 | public static void setUpEnv() { 28 | System.setProperty("weavingMode", "compile"); 29 | } 30 | 31 | @Override 32 | protected UserService createUserService() { 33 | return new UserService(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHookDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.executionhook; 17 | 18 | /** 19 | * Default implementations of {@link HystrixCommandExecutionHook} that does nothing. 20 | * 21 | * @ExcludeFromJavadoc 22 | */ 23 | public class HystrixCommandExecutionHookDefault extends HystrixCommandExecutionHook { 24 | 25 | private static HystrixCommandExecutionHookDefault INSTANCE = new HystrixCommandExecutionHookDefault(); 26 | 27 | private HystrixCommandExecutionHookDefault() { 28 | 29 | } 30 | 31 | public static HystrixCommandExecutionHook getInstance() { 32 | return INSTANCE; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/fallback/CommandFallbackTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.fallback; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.fallback.BasicCommandFallbackTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class CommandFallbackTest extends BasicCommandFallbackTest { 25 | 26 | @BeforeClass 27 | public static void setUpEnv() { 28 | System.setProperty("weavingMode", "compile"); 29 | } 30 | 31 | @Override 32 | protected UserService createUserService() { 33 | return new UserService(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/error/ErrorPropagationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.error; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.error.BasicErrorPropagationTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class ErrorPropagationTest extends BasicErrorPropagationTest { 25 | 26 | @BeforeClass 27 | public static void setUpEnv() { 28 | System.setProperty("weavingMode", "compile"); 29 | } 30 | 31 | @Override 32 | protected UserService createUserService() { 33 | return new UserService(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixConcurrencyStrategyDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.concurrency; 17 | 18 | /** 19 | * Default implementation of {@link HystrixConcurrencyStrategy} using standard java.util.concurrent.* implementations. 20 | * 21 | * @ExcludeFromJavadoc 22 | */ 23 | public class HystrixConcurrencyStrategyDefault extends HystrixConcurrencyStrategy { 24 | 25 | private static HystrixConcurrencyStrategyDefault INSTANCE = new HystrixConcurrencyStrategyDefault(); 26 | 27 | public static HystrixConcurrencyStrategy getInstance() { 28 | return INSTANCE; 29 | } 30 | 31 | private HystrixConcurrencyStrategyDefault() { 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/conf/SpringApplicationContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.conf; 17 | 18 | import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect; 19 | import org.springframework.beans.factory.annotation.Configurable; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.ComponentScan; 22 | 23 | @Configurable 24 | @ComponentScan("com.netflix.hystrix.contrib.javanica.test.spring") 25 | public class SpringApplicationContext { 26 | 27 | @Bean 28 | public HystrixCommandAspect hystrixAspect() { 29 | return new HystrixCommandAspect(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/cache/CacheTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.cache; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.cache.BasicCacheTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class CacheTest extends BasicCacheTest { 25 | @BeforeClass 26 | public static void setUpEnv() { 27 | System.setProperty("weavingMode", "compile"); 28 | } 29 | 30 | @Override 31 | protected UserService createUserService() { 32 | UserService userService = new UserService(); 33 | userService.init(); 34 | return userService; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/HystrixCachingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | /** 19 | * Indicates that something is going wrong with caching logic. 20 | * 21 | * @author dmgcodevil 22 | */ 23 | public class HystrixCachingException extends RuntimeException { 24 | 25 | public HystrixCachingException() { 26 | } 27 | 28 | public HystrixCachingException(String message) { 29 | super(message); 30 | } 31 | 32 | public HystrixCachingException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public HystrixCachingException(Throwable cause) { 37 | super(cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/command/jdk/CommandJdkProxyTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.command.jdk; 17 | 18 | 19 | import com.netflix.hystrix.contrib.javanica.test.spring.command.CommandTest; 20 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopJdkConfig; 21 | import org.junit.runner.RunWith; 22 | import org.springframework.test.context.ContextConfiguration; 23 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 24 | 25 | @RunWith(SpringJUnit4ClassRunner.class) 26 | @ContextConfiguration(classes = {AopJdkConfig.class, CommandTest.CommandTestConfig.class}) 27 | public class CommandJdkProxyTest extends CommandTest { 28 | } 29 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/command/cglib/CommandCGlibProxyTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.command.cglib; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.spring.command.CommandTest; 19 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 20 | import org.junit.runner.RunWith; 21 | import org.springframework.test.context.ContextConfiguration; 22 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 23 | 24 | @RunWith(SpringJUnit4ClassRunner.class) 25 | @ContextConfiguration(classes = {AopCglibConfig.class, CommandTest.CommandTestConfig.class}) 26 | public class CommandCGlibProxyTest extends CommandTest { 27 | } 28 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/CommandActionExecutionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | /** 19 | * This exception is used to wrap original exceptions to push through javanica infrastructure. 20 | */ 21 | public class CommandActionExecutionException extends RuntimeException { 22 | 23 | /** 24 | * Creates exceptions instance with cause is original exception. 25 | * 26 | * @param cause the original exception 27 | */ 28 | public CommandActionExecutionException(Throwable cause) { 29 | super(cause); 30 | } 31 | 32 | /** 33 | * Default constructor. 34 | */ 35 | public CommandActionExecutionException() { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | /** 19 | * Default implementation of {@link HystrixMetricsPublisher}. 20 | *

21 | * See Wiki docs about plugins for more information. 22 | * 23 | * @ExcludeFromJavadoc 24 | */ 25 | public class HystrixMetricsPublisherDefault extends HystrixMetricsPublisher { 26 | 27 | private static HystrixMetricsPublisherDefault INSTANCE = new HystrixMetricsPublisherDefault(); 28 | 29 | public static HystrixMetricsPublisher getInstance() { 30 | return INSTANCE; 31 | } 32 | 33 | private HystrixMetricsPublisherDefault() { 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-codahale-metrics-publisher/README.md: -------------------------------------------------------------------------------- 1 | # hystrix-codahale-metrics-publisher 2 | 3 | This is an implementation of [HystrixMetricsPublisher](http://netflix.github.com/Hystrix/javadoc/index.html?com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.html) that publishes metrics using [Coda Hale Metrics](http://metrics.codahale.com) version 3. If you are using Yammer Metrics version 2, please use the [hystrix-yammer-metrics-publisher](../hystrix-yammer-metrics-publisher) module instead. 4 | 5 | See the [Metrics & Monitoring](https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring) Wiki for more information. 6 | 7 | # Binaries 8 | 9 | Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22hystrix-codahale-metrics-publisher%22). 10 | 11 | Example for Maven: 12 | 13 | ```xml 14 | 15 | com.netflix.hystrix 16 | hystrix-codahale-metrics-publisher 17 | 1.1.2 18 | 19 | ``` 20 | 21 | and for Ivy: 22 | 23 | ```xml 24 | 25 | ``` 26 | 27 | Example usage (make it work/plug it in): 28 | 29 | HystrixPlugins.getInstance().registerMetricsPublisher(new HystrixCodahaleMetricsPublisher(yourMetricRegistry)); 30 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/configuration/command/CommandPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.configuration.command; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.command.BasicCommandPropertiesTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class CommandPropertiesTest extends BasicCommandPropertiesTest { 25 | 26 | @BeforeClass 27 | public static void setUpEnv() { 28 | System.setProperty("weavingMode", "compile"); 29 | } 30 | 31 | @Override 32 | protected UserService createUserService() { 33 | return new UserService(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/configuration/collapser/CollapserPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.configuration.collapser; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.collapser.BasicCollapserPropertiesTest; 19 | import org.junit.BeforeClass; 20 | 21 | /** 22 | * Created by dmgcodevil 23 | */ 24 | public class CollapserPropertiesTest extends BasicCollapserPropertiesTest { 25 | 26 | @BeforeClass 27 | public static void setUpEnv() { 28 | System.setProperty("weavingMode", "compile"); 29 | } 30 | 31 | @Override 32 | protected UserService createUserService() { 33 | return new UserService(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/metric/sample/HystrixCommandUtilization.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.metric.sample; 17 | 18 | import com.netflix.hystrix.HystrixCommandMetrics; 19 | 20 | public class HystrixCommandUtilization { 21 | private final int concurrentCommandCount; 22 | 23 | public HystrixCommandUtilization(int concurrentCommandCount) { 24 | this.concurrentCommandCount = concurrentCommandCount; 25 | } 26 | 27 | public static HystrixCommandUtilization sample(HystrixCommandMetrics commandMetrics) { 28 | return new HystrixCommandUtilization(commandMetrics.getCurrentConcurrentExecutionCount()); 29 | } 30 | 31 | public int getConcurrentCommandCount() { 32 | return concurrentCommandCount; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/collapser/RealCollapserTimer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.collapser; 17 | 18 | import java.lang.ref.Reference; 19 | 20 | import com.netflix.hystrix.util.HystrixTimer; 21 | import com.netflix.hystrix.util.HystrixTimer.TimerListener; 22 | 23 | /** 24 | * Actual CollapserTimer implementation for triggering batch execution that uses HystrixTimer. 25 | */ 26 | public class RealCollapserTimer implements CollapserTimer { 27 | /* single global timer that all collapsers will schedule their tasks on */ 28 | private final static HystrixTimer timer = HystrixTimer.getInstance(); 29 | 30 | @Override 31 | public Reference addListener(TimerListener collapseTask) { 32 | return timer.addTimerListener(collapseTask); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/configuration/fallback/FallbackDefaultPropertiesTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.configuration.fallback; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.fallback.BasicFallbackDefaultPropertiesTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Configurable; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | @RunWith(SpringJUnit4ClassRunner.class) 13 | @ContextConfiguration(classes = {AopCglibConfig.class, FallbackDefaultPropertiesTest.Config.class}) 14 | public class FallbackDefaultPropertiesTest extends BasicFallbackDefaultPropertiesTest { 15 | 16 | @Autowired 17 | private Service service; 18 | 19 | @Override 20 | protected Service createService() { 21 | return service; 22 | } 23 | 24 | @Configurable 25 | public static class Config { 26 | @Bean 27 | public BasicFallbackDefaultPropertiesTest.Service service() { 28 | return new BasicFallbackDefaultPropertiesTest.Service(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/simplegrid/986_grid.css: -------------------------------------------------------------------------------- 1 | /* SimpleGrid - a fork of CSSGrid by Crowd Favorite (https://github.com/crowdfavorite/css-grid) 2 | * http://simplegrid.info 3 | * by Conor Muirhead (http://conor.cc) of Early LLC (http://earlymade.com) 4 | * License: http://creativecommons.org/licenses/MIT/ */ 5 | 6 | /* Containers */ 7 | body { font-size: 100%; } 8 | .grid{ width:966px; } 9 | 10 | /* Slots Setup */ 11 | .slot-0,.slot-1,.slot-2,.slot-3,.slot-4,.slot-5,.slot-0-1,.slot-0-1-2,.slot-0-1-2-3,.slot-0-1-2-3-4,.slot-0-1-2-3-4-5,.slot-1-2,.slot-1-2-3,.slot-1-2-3-4,.slot-1-2-3-4-5,.slot-2-3,.slot-2-3-4,.slot-2-3-4-5,.slot-3-4,.slot-3-4-5,.slot-4-5,.slot-6,.slot-7,.slot-8,.slot-9,.slot-6-7,.slot-6-7-8,.slot-6-7-8-9,.slot-7-8,.slot-7-8-9,.slot-8-9{ display:inline; float:left; margin-left:30px; } 12 | 13 | /* 6-Col Grid Sizes */ 14 | .slot-0,.slot-1,.slot-2,.slot-3,.slot-4,.slot-5{ width:136px; } /* Sixths */ 15 | .slot-0-1,.slot-1-2,.slot-2-3,.slot-3-4,.slot-4-5{ width:302px; } /* Thirds */ 16 | .slot-0-1-2-3,.slot-1-2-3-4,.slot-2-3-4-5{ width:634px; } /* Two-Thirds */ 17 | .slot-0-1-2-3-4,.slot-1-2-3-4-5{ width:800px; } /* Five-Sixths */ 18 | 19 | /* 4-Col Grid Sizes */ 20 | .slot-6,.slot-7,.slot-8,.slot-9{ width:219px; } /* Quarters */ 21 | .slot-6-7-8,.slot-7-8-9{ width:717px; } /* Three-Quarters */ 22 | 23 | /* 6-Col/4-Col Shared Grid Sizes */ 24 | .slot-0-1-2,.slot-1-2-3,.slot-2-3-4,.slot-3-4-5, .slot-6-7,.slot-7-8,.slot-8-9{ width:468px; } /* Halves */ -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/exception/HystrixCacheKeyGenerationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.exception; 17 | 18 | /** 19 | * Indicates that something is going wrong with cache key generation logic. 20 | * 21 | * @author dmgcodevil 22 | */ 23 | public class HystrixCacheKeyGenerationException extends RuntimeException { 24 | 25 | public HystrixCacheKeyGenerationException() { 26 | } 27 | 28 | public HystrixCacheKeyGenerationException(String message) { 29 | super(message); 30 | } 31 | 32 | public HystrixCacheKeyGenerationException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public HystrixCacheKeyGenerationException(Throwable cause) { 37 | super(cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/error/ObservableErrorPropagationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.error; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.error.BasicErrorPropagationTest; 19 | import com.netflix.hystrix.contrib.javanica.test.common.error.BasicObservableErrorPropagationTest; 20 | import org.junit.BeforeClass; 21 | 22 | /** 23 | * Created by dmgcodevil 24 | */ 25 | public class ObservableErrorPropagationTest extends BasicObservableErrorPropagationTest { 26 | 27 | @BeforeClass 28 | public static void setUpEnv() { 29 | System.setProperty("weavingMode", "compile"); 30 | } 31 | 32 | @Override 33 | protected UserService createUserService() { 34 | return new UserService(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-serialization/src/main/java/com/netflix/hystrix/serial/SerialHystrixMetric.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.serial; 17 | 18 | import com.fasterxml.jackson.core.JsonFactory; 19 | import com.fasterxml.jackson.databind.ObjectMapper; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | import java.nio.ByteBuffer; 24 | 25 | public class SerialHystrixMetric { 26 | protected final static JsonFactory jsonFactory = new JsonFactory(); 27 | protected final static ObjectMapper mapper = new ObjectMapper(); 28 | protected final static Logger logger = LoggerFactory.getLogger(SerialHystrixMetric.class); 29 | 30 | @Deprecated 31 | public static String fromByteBufferToString(ByteBuffer bb) { 32 | throw new UnsupportedOperationException("Not implemented anymore. Will be implemented in a new class shortly"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/fallback/InheritedFallbackTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.fallback; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.fallback.BasicCommandFallbackTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Configurable; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | /** 13 | * Created by dmgcodevil. 14 | */ 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @ContextConfiguration(classes = {AopCglibConfig.class, InheritedFallbackTest.CommandTestConfig.class}) 17 | public class InheritedFallbackTest extends BasicCommandFallbackTest { 18 | 19 | @Autowired 20 | private UserService userService; 21 | 22 | @Override 23 | protected BasicCommandFallbackTest.UserService createUserService() { 24 | return userService; 25 | } 26 | 27 | @Configurable 28 | public static class CommandTestConfig { 29 | @Bean 30 | public UserService userService() { 31 | return new SubClass(); 32 | } 33 | } 34 | 35 | public static class SubClass extends BasicCommandFallbackTest.UserService { 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixDynamicProperty.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.properties; 17 | 18 | /** 19 | * Generic interface to represent a dynamic property value so Hystrix can consume 20 | * properties without being tied to any particular backing implementation. 21 | * 22 | * @author agentgt 23 | * 24 | * @param 25 | * Type of property value. 26 | * @see HystrixProperty 27 | * @see HystrixDynamicProperties 28 | */ 29 | public interface HystrixDynamicProperty extends HystrixProperty{ 30 | 31 | public String getName(); 32 | 33 | /** 34 | * Register a callback to be run if the property is updated. 35 | * Backing implementations may choose to do nothing. 36 | * @param callback callback. 37 | */ 38 | public void addCallback(Runnable callback); 39 | 40 | } -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Michael Bostock 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * The name Michael Bostock may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixGeneratedCacheKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.cache; 17 | 18 | /** 19 | * Specific interface to adopt {@link HystrixGeneratedCacheKey} for Hystrix environment. 20 | * 21 | * @author dmgcodevil 22 | */ 23 | public interface HystrixGeneratedCacheKey { 24 | 25 | /** 26 | * Key to be used for request caching. 27 | *

28 | * By default this returns null which means "do not cache". 29 | *

30 | * To enable caching override this method and return a string key uniquely representing the state of a command instance. 31 | *

32 | * If multiple command instances in the same request scope match keys then only the first will be executed and all others returned from cache. 33 | * 34 | * @return cacheKey 35 | */ 36 | String getCacheKey(); 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/annotation/HystrixProperty.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * This annotation allows specify Hystrix command properties in the following format: 26 | * property name = property value. 27 | */ 28 | @Target({ElementType.METHOD}) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | public @interface HystrixProperty { 32 | 33 | /** 34 | * Property name. 35 | * 36 | * @return name 37 | */ 38 | String name(); 39 | 40 | /** 41 | * Property value 42 | * 43 | * @return value 44 | */ 45 | String value(); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/DefaultIgnoreExceptionsTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.error; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.error.BasicDefaultIgnoreExceptionsTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Configurable; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | /** 13 | * Created by dmgcodevil. 14 | */ 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @ContextConfiguration(classes = {AopCglibConfig.class, DefaultIgnoreExceptionsTest.DefaultIgnoreExceptionsTestConfig.class}) 17 | public class DefaultIgnoreExceptionsTest extends BasicDefaultIgnoreExceptionsTest { 18 | 19 | 20 | @Autowired 21 | private BasicDefaultIgnoreExceptionsTest.Service service; 22 | 23 | @Override 24 | protected BasicDefaultIgnoreExceptionsTest.Service createService() { 25 | return service; 26 | } 27 | 28 | @Configurable 29 | public static class DefaultIgnoreExceptionsTestConfig { 30 | 31 | @Bean 32 | public BasicDefaultIgnoreExceptionsTest.Service userService() { 33 | return new BasicDefaultIgnoreExceptionsTest.Service(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/simplegrid/percentage_grid.css: -------------------------------------------------------------------------------- 1 | /* Extension of SimpleGrid by benjchristensen to allow percentage based sizing on very large displays 2 | * 3 | * SimpleGrid - a fork of CSSGrid by Crowd Favorite (https://github.com/crowdfavorite/css-grid) 4 | * http://simplegrid.info 5 | * by Conor Muirhead (http://conor.cc) of Early LLC (http://earlymade.com) 6 | * License: http://creativecommons.org/licenses/MIT/ */ 7 | 8 | /* Containers */ 9 | body { font-size: 1.125em; } 10 | .grid{ width:100%; } 11 | 12 | /* Slots Setup */ 13 | .slot-0,.slot-1,.slot-2,.slot-3,.slot-4,.slot-5,.slot-0-1,.slot-0-1-2,.slot-0-1-2-3,.slot-0-1-2-3-4,.slot-0-1-2-3-4-5,.slot-1-2,.slot-1-2-3,.slot-1-2-3-4,.slot-1-2-3-4-5,.slot-2-3,.slot-2-3-4,.slot-2-3-4-5,.slot-3-4,.slot-3-4-5,.slot-4-5,.slot-6,.slot-7,.slot-8,.slot-9,.slot-6-7,.slot-6-7-8,.slot-6-7-8-9,.slot-7-8,.slot-7-8-9,.slot-8-9{ display:inline; float:left; margin-left:0px; } 14 | 15 | 16 | /* 6-Col Grid Sizes */ 17 | .slot-0,.slot-1,.slot-2,.slot-3,.slot-4,.slot-5{ width:16.6%; } /* Sixths */ 18 | .slot-0-1,.slot-1-2,.slot-2-3,.slot-3-4,.slot-4-5{ width:33.3%; } /* Thirds */ 19 | .slot-0-1-2-3,.slot-1-2-3-4,.slot-2-3-4-5{ width:66.6%; } /* Two-Thirds */ 20 | .slot-0-1-2-3-4,.slot-1-2-3-4-5{ width:83.3%; } /* Five-Sixths */ 21 | 22 | /* 4-Col Grid Sizes */ 23 | .slot-6,.slot-7,.slot-8,.slot-9{ width:25%; } /* Quarters */ 24 | .slot-6-7-8,.slot-7-8-9{ width:75%; } /* Three-Quarters */ 25 | 26 | /* 6-Col/4-Col Shared Grid Sizes */ 27 | .slot-0-1-2,.slot-1-2-3,.slot-2-3-4,.slot-3-4-5, .slot-6-7,.slot-7-8,.slot-8-9{ width:50%; } /* Halves */ -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-clj/README.md: -------------------------------------------------------------------------------- 1 | # Hystrix Clojure Bindings 2 | 3 | This module contains idiomatic Clojure bindings for Hystrix. 4 | 5 | # Binaries 6 | 7 | Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22hystrix-clj%22). 8 | 9 | Example for Maven: 10 | 11 | ```xml 12 | 13 | com.netflix.hystrix 14 | hystrix-clj 15 | x.y.z 16 | 17 | ``` 18 | 19 | and for Ivy: 20 | 21 | ```xml 22 | 23 | ``` 24 | 25 | and for Leiningen: 26 | 27 | ```clojure 28 | [com.netflix.hystrix/hystrix-clj "x.y.z"] 29 | ``` 30 | 31 | # Usage 32 | 33 | Please see the docstrings in src/com/netflix/hystrix/core.clj for extensive usage info. 34 | 35 | ## TL;DR 36 | You have a function that interacts with an untrusted dependency: 37 | 38 | ```clojure 39 | (defn make-request 40 | [arg] 41 | ... make the request ...) 42 | 43 | ; execute the request 44 | (make-request "baz") 45 | ``` 46 | 47 | and you want to make it a Hystrix dependency command. Do this: 48 | 49 | ```clojure 50 | (defcommand make-request 51 | [arg] 52 | ... make the request ...) 53 | 54 | ; execute the request 55 | (make-request "baz") 56 | 57 | ; or queue for async execution 58 | (queue #'make-request "baz") 59 | ``` 60 | 61 | # Event Stream 62 | 63 | A Clojure version of hystrix-event-stream can be found at https://github.com/josephwilk/hystrix-event-stream-clj 64 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/components/hystrixThreadPool/templates/hystrixThreadPool.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | 7 | 10 | 11 |
12 | 13 |
14 |
Active
15 |
<%= currentActiveCount%>
16 | 17 |
Max Active
18 |
<%= addCommas(rollingMaxActiveThreads)%>
19 |
20 | 21 |
22 |
Queued
23 |
<%= currentQueueSize %>
24 |
Executions
25 |
<%= addCommas(rollingCountThreadsExecuted)%>
26 |
27 |
28 |
Pool Size
29 |
<%= currentPoolSize %>
30 |
Queue Size
31 |
<%= propertyValue_queueSizeRejectionThreshold %>
32 |
33 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/closure/ClosureFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command.closure; 17 | 18 | import com.netflix.hystrix.contrib.javanica.command.MetaHolder; 19 | 20 | import java.lang.reflect.Method; 21 | 22 | /** 23 | * Factory to create instances of {@link Closure} class. 24 | */ 25 | public interface ClosureFactory { 26 | 27 | /** 28 | * Creates closure in accordance with method return type. 29 | * 30 | * @param metaHolder the meta holder 31 | * @param method the external method within which closure is created 32 | * @param o the object the underlying method is invoked from 33 | * @param args the arguments used for the method call 34 | * @return new {@link Closure} instance 35 | */ 36 | Closure createClosure(final MetaHolder metaHolder, final Method method, final Object o, final Object... args); 37 | } 38 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/configuration/command/CommandDefaultPropertiesTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.configuration.command; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.command.BasicCommandDefaultPropertiesTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Configurable; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Scope; 10 | import org.springframework.test.context.ContextConfiguration; 11 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 12 | 13 | /** 14 | * Created by dmgcodevil. 15 | */ 16 | @RunWith(SpringJUnit4ClassRunner.class) 17 | @ContextConfiguration(classes = {AopCglibConfig.class, CommandDefaultPropertiesTest.Config.class}) 18 | public class CommandDefaultPropertiesTest extends BasicCommandDefaultPropertiesTest { 19 | 20 | @Autowired 21 | private Service service; 22 | 23 | @Override 24 | protected Service createService() { 25 | return service; 26 | } 27 | 28 | @Configurable 29 | public static class Config { 30 | @Bean 31 | @Scope(value = "prototype") 32 | public BasicCommandDefaultPropertiesTest.Service service() { 33 | return new BasicCommandDefaultPropertiesTest.Service(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/UrlUtils.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.dashboard.stream; 2 | 3 | import java.io.InputStream; 4 | import java.net.HttpURLConnection; 5 | import java.net.URL; 6 | 7 | /** 8 | * Copyright 2013 Netflix, Inc. 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | /** 23 | * Utility class to work with InputStreams 24 | * 25 | * @author diegopacheco 26 | * 27 | */ 28 | public class UrlUtils { 29 | 30 | public static InputStream readXmlInputStream(String uri){ 31 | 32 | if (uri==null || "".equals(uri)) throw new IllegalArgumentException("Invalid uri. URI cannot be null or blank. "); 33 | 34 | try{ 35 | URL url = new URL(uri); 36 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 37 | connection.setRequestMethod("GET"); 38 | connection.setRequestProperty("Accept", "application/xml"); 39 | 40 | return connection.getInputStream(); 41 | 42 | }catch(Exception e){ 43 | throw new RuntimeException(e); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | MockStreamServlet 10 | MockStreamServlet 11 | com.netflix.hystrix.dashboard.stream.MockStreamServlet 12 | 13 | 14 | MockStreamServlet 15 | /mock.stream 16 | 17 | 18 | 19 | 20 | 21 | ProxyStreamServlet 22 | ProxyStreamServlet 23 | com.netflix.hystrix.dashboard.stream.ProxyStreamServlet 24 | 25 | 26 | ProxyStreamServlet 27 | /proxy.stream 28 | 29 | 30 | 31 | 32 | EurekaInfoServlet 33 | EurekaInfoServlet 34 | com.netflix.hystrix.dashboard.stream.EurekaInfoServlet 35 | 36 | 37 | EurekaInfoServlet 38 | /eureka 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/closure/Closure.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command.closure; 17 | 18 | import java.lang.reflect.Method; 19 | 20 | /** 21 | * Contains method and instance of anonymous class which implements 22 | * {@link com.netflix.hystrix.contrib.javanica.command.ClosureCommand} interface. 23 | */ 24 | public class Closure { 25 | 26 | private final Method closureMethod; 27 | private final Object closureObj; 28 | 29 | public Closure() { 30 | closureMethod = null; 31 | closureObj = null; 32 | } 33 | 34 | public Closure(Method closureMethod, Object closureObj) { 35 | this.closureMethod = closureMethod; 36 | this.closureObj = closureObj; 37 | } 38 | 39 | public Method getClosureMethod() { 40 | return closureMethod; 41 | } 42 | 43 | public Object getClosureObj() { 44 | return closureObj; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/js/tmpl.js: -------------------------------------------------------------------------------- 1 | 2 | //Simple JavaScript Templating 3 | //John Resig - http://ejohn.org/ - MIT Licensed 4 | // http://ejohn.org/blog/javascript-micro-templating/ 5 | (function(window, undefined) { 6 | var cache = {}; 7 | 8 | window.tmpl = function tmpl(str, data) { 9 | try { 10 | // Figure out if we're getting a template, or if we need to 11 | // load the template - and be sure to cache the result. 12 | var fn = !/\W/.test(str) ? 13 | cache[str] = cache[str] || 14 | tmpl(document.getElementById(str).innerHTML) : 15 | 16 | // Generate a reusable function that will serve as a template 17 | // generator (and which will be cached). 18 | new Function("obj", 19 | "var p=[],print=function(){p.push.apply(p,arguments);};" + 20 | 21 | // Introduce the data as local variables using with(){} 22 | "with(obj){p.push('" + 23 | 24 | // Convert the template into pure JavaScript 25 | str 26 | .replace(/[\r\t\n]/g, " ") 27 | .split("<%").join("\t") 28 | .replace(/((^|%>)[^\t]*)'/g, "$1\r") 29 | .replace(/\t=(.*?)%>/g, "',$1,'") 30 | .split("\t").join("');") 31 | .split("%>").join("p.push('") 32 | .split("\r").join("\\'") 33 | + "');}return p.join('');"); 34 | 35 | //console.log(fn); 36 | 37 | // Provide some basic currying to the user 38 | return data ? fn(data) : fn; 39 | }catch(e) { 40 | console.log(e); 41 | } 42 | }; 43 | })(window); 44 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/error/DefaultRaiseHystrixExceptionsTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.error; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.beans.factory.annotation.Configurable; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.test.context.ContextConfiguration; 8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 9 | 10 | import com.netflix.hystrix.contrib.javanica.test.common.error.BasicDefaultRaiseHystrixExceptionsTest; 11 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 12 | 13 | /** 14 | * Created by Mike Cowan 15 | */ 16 | @RunWith(SpringJUnit4ClassRunner.class) 17 | @ContextConfiguration(classes = {AopCglibConfig.class, DefaultRaiseHystrixExceptionsTest.DefaultRaiseHystrixExceptionsTestConfig.class}) 18 | public class DefaultRaiseHystrixExceptionsTest extends BasicDefaultRaiseHystrixExceptionsTest { 19 | 20 | @Autowired 21 | private BasicDefaultRaiseHystrixExceptionsTest.Service service; 22 | 23 | @Override 24 | protected BasicDefaultRaiseHystrixExceptionsTest.Service createService() { 25 | return service; 26 | } 27 | 28 | @Configurable 29 | public static class DefaultRaiseHystrixExceptionsTestConfig { 30 | 31 | @Bean 32 | public BasicDefaultRaiseHystrixExceptionsTest.Service userService() { 33 | return new BasicDefaultRaiseHystrixExceptionsTest.Service(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/exception/HystrixTimeoutException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.exception; 17 | 18 | import com.netflix.hystrix.HystrixCommand; 19 | import com.netflix.hystrix.HystrixObservableCommand; 20 | 21 | /** 22 | * An exception representing an error where the provided execution method took longer than the Hystrix timeout. 23 | *

24 | * Hystrix will trigger an exception of this type if it times out an execution. This class is public, so 25 | * user-defined execution methods ({@link HystrixCommand#run()} / {@link HystrixObservableCommand#construct()) may also 26 | * throw this error. If you want some types of failures to be counted as timeouts, you may wrap those failures in 27 | * a HystrixTimeoutException. See https://github.com/Netflix/Hystrix/issues/920 for more discussion. 28 | */ 29 | public class HystrixTimeoutException extends Exception { 30 | 31 | private static final long serialVersionUID = -5085623652043595962L; 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/PaymentInformation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.examples.demo; 17 | 18 | /** 19 | * POJO 20 | */ 21 | public class PaymentInformation { 22 | 23 | private final UserAccount user; 24 | private final String creditCardNumber; 25 | private final int expirationMonth; 26 | private final int expirationYear; 27 | 28 | public PaymentInformation(UserAccount user, String creditCardNumber, int expirationMonth, int expirationYear) { 29 | this.user = user; 30 | this.creditCardNumber = creditCardNumber; 31 | this.expirationMonth = expirationMonth; 32 | this.expirationYear = expirationYear; 33 | } 34 | 35 | public String getCreditCardNumber() { 36 | return creditCardNumber; 37 | } 38 | 39 | public int getExpirationMonth() { 40 | return expirationMonth; 41 | } 42 | 43 | public int getExpirationYear() { 44 | return expirationYear; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/annotation/ObservableExecutionMode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.annotation; 17 | 18 | import com.netflix.hystrix.HystrixObservable; 19 | import rx.Observable; 20 | 21 | /** 22 | * Hystrix observable command can be executed in two different ways: 23 | * eager - {@link HystrixObservable#observe()}, 24 | * lazy - {@link HystrixObservable#toObservable()}. 25 | *

26 | * This enum is used to specify desire execution mode. 27 | *

28 | * Created by dmgcodevil. 29 | */ 30 | public enum ObservableExecutionMode { 31 | 32 | /** 33 | * This mode lazily starts execution of the command only once the {@link Observable} is subscribed to. 34 | */ 35 | LAZY, 36 | 37 | /** 38 | * This mode eagerly starts execution of the command the same as {@link com.netflix.hystrix.HystrixCommand#queue()} 39 | * and {@link com.netflix.hystrix.HystrixCommand#execute()}. 40 | */ 41 | EAGER 42 | } 43 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/ajcTest/java/com/netflix/hystrix/contrib/javanica/test/aspectj/command/CommandTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.aspectj.command; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.command.BasicCommandTest; 19 | import com.netflix.hystrix.contrib.javanica.test.common.domain.User; 20 | import org.junit.BeforeClass; 21 | 22 | 23 | public class CommandTest extends BasicCommandTest { 24 | 25 | @BeforeClass 26 | public static void setUpEnv(){ 27 | System.setProperty("weavingMode", "compile"); 28 | } 29 | 30 | @Override 31 | protected UserService createUserService() { 32 | return new UserService(); 33 | } 34 | 35 | @Override 36 | protected AdvancedUserService createAdvancedUserServiceService() { 37 | return new AdvancedUserService(); 38 | } 39 | 40 | @Override 41 | protected GenericService createGenericUserService() { 42 | return new GenericUserService(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherCollapserDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixCollapserKey; 19 | import com.netflix.hystrix.HystrixCollapserMetrics; 20 | import com.netflix.hystrix.HystrixCollapserProperties; 21 | 22 | /** 23 | * Default implementation of {@link HystrixMetricsPublisherCollapser} that does nothing. 24 | *

25 | * See Wiki docs about plugins for more information. 26 | * 27 | * @ExcludeFromJavadoc 28 | */ 29 | public class HystrixMetricsPublisherCollapserDefault implements HystrixMetricsPublisherCollapser { 30 | 31 | public HystrixMetricsPublisherCollapserDefault(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) { 32 | // do nothing by default 33 | } 34 | 35 | @Override 36 | public void initialize() { 37 | // do nothing by default 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /hystrix-core/src/jmh/java/com/netflix/hystrix/perf/CommandConstructionPerfTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.perf; 17 | 18 | import com.netflix.hystrix.HystrixCommand; 19 | import com.netflix.hystrix.HystrixCommandGroupKey; 20 | import org.openjdk.jmh.annotations.Benchmark; 21 | import org.openjdk.jmh.annotations.BenchmarkMode; 22 | import org.openjdk.jmh.annotations.Mode; 23 | import org.openjdk.jmh.annotations.OutputTimeUnit; 24 | 25 | import java.util.concurrent.TimeUnit; 26 | 27 | public class CommandConstructionPerfTest { 28 | 29 | static HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey("Group"); 30 | 31 | @Benchmark 32 | @BenchmarkMode({Mode.SingleShotTime}) 33 | @OutputTimeUnit(TimeUnit.MICROSECONDS) 34 | public HystrixCommand constructHystrixCommandByGroupKeyOnly() { 35 | return new HystrixCommand(groupKey) { 36 | @Override 37 | protected Integer run() throws Exception { 38 | return 1; 39 | } 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherThreadPoolDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixThreadPoolKey; 19 | import com.netflix.hystrix.HystrixThreadPoolMetrics; 20 | import com.netflix.hystrix.HystrixThreadPoolProperties; 21 | 22 | /** 23 | * Default implementation of {@link HystrixMetricsPublisherThreadPool} that does nothing. 24 | *

25 | * See Wiki docs about plugins for more information. 26 | * 27 | * @ExcludeFromJavadoc 28 | */ 29 | public class HystrixMetricsPublisherThreadPoolDefault implements HystrixMetricsPublisherThreadPool { 30 | 31 | public HystrixMetricsPublisherThreadPoolDefault(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { 32 | // do nothing by default 33 | } 34 | 35 | @Override 36 | public void initialize() { 37 | // do nothing by default 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/exception/HystrixBadRequestException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.exception; 17 | 18 | import com.netflix.hystrix.HystrixCommand; 19 | 20 | /** 21 | * An exception representing an error with provided arguments or state rather than an execution failure. 22 | *

23 | * Unlike all other exceptions thrown by a {@link HystrixCommand} this will not trigger fallback, not count against failure metrics and thus not trigger the circuit breaker. 24 | *

25 | * NOTE: This should only be used when an error is due to user input such as {@link IllegalArgumentException} otherwise it defeats the purpose of fault-tolerance and fallback behavior. 26 | */ 27 | public class HystrixBadRequestException extends RuntimeException { 28 | 29 | private static final long serialVersionUID = -8341452103561805856L; 30 | 31 | public HystrixBadRequestException(String message) { 32 | super(message); 33 | } 34 | 35 | public HystrixBadRequestException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/util/GetMethodTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.util; 2 | 3 | import com.google.common.base.Optional; 4 | import com.netflix.hystrix.contrib.javanica.utils.MethodProvider; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.junit.runners.Parameterized; 8 | 9 | import java.lang.reflect.Method; 10 | import java.util.Arrays; 11 | import java.util.Collection; 12 | 13 | import static org.junit.Assert.assertEquals; 14 | import static org.junit.Assert.assertTrue; 15 | 16 | /** 17 | * Created by dmgcodevil. 18 | */ 19 | @RunWith(Parameterized.class) 20 | public class GetMethodTest { 21 | 22 | private String methodName; 23 | private Class[] parametersTypes; 24 | 25 | @Parameterized.Parameters 26 | public static Collection data() { 27 | return Arrays.asList(new Object[][] { 28 | { "foo", new Class[]{ String.class } }, 29 | { "bar", new Class[]{ Integer.class } } 30 | }); 31 | } 32 | 33 | public GetMethodTest(String methodName, Class[] parametersTypes) { 34 | this.methodName = methodName; 35 | this.parametersTypes = parametersTypes; 36 | } 37 | 38 | @Test 39 | public void testGetMethodFoo(){ 40 | Optional method = MethodProvider.getInstance().getMethod(C.class, methodName, parametersTypes); 41 | 42 | assertTrue(method.isPresent()); 43 | assertEquals(methodName, method.get().getName()); 44 | } 45 | 46 | 47 | public static class A { void foo(String in) {} } 48 | public static class B extends A { void bar(Integer in) {} } 49 | public static class C extends B{ } 50 | 51 | } -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/components/hystrixThreadPool/templates/hystrixThreadPoolContainer.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | <% 4 | var displayName = name; 5 | var toolTip = ""; 6 | if(displayName.length > 32) { 7 | displayName = displayName.substring(0,4) + "..." + displayName.substring(displayName.length-20, displayName.length); 8 | toolTip = "title=\"" + name + "\""; 9 | } 10 | %> 11 | 12 |
13 |

><%= displayName %>

14 |
15 |
16 |
17 | 18 | 19 | 33 | 34 |
35 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/closure/AsyncClosureFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command.closure; 17 | 18 | import com.netflix.hystrix.contrib.javanica.command.AsyncResult; 19 | import com.netflix.hystrix.contrib.javanica.command.ClosureCommand; 20 | 21 | /** 22 | * Specific implementation of {@link ClosureFactory}. 23 | */ 24 | public class AsyncClosureFactory extends AbstractClosureFactory { 25 | 26 | private static final AsyncClosureFactory INSTANCE = new AsyncClosureFactory(); 27 | 28 | private AsyncClosureFactory() { 29 | } 30 | 31 | public static AsyncClosureFactory getInstance() { 32 | return INSTANCE; 33 | } 34 | 35 | /** 36 | * {@inheritDoc}. 37 | */ 38 | @Override 39 | boolean isClosureCommand(Object closureObj) { 40 | return closureObj instanceof AsyncResult; 41 | } 42 | 43 | /** 44 | * {@inheritDoc}. 45 | */ 46 | @Override 47 | Class getClosureCommandType() { 48 | return AsyncResult.class; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/EnvUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.utils; 17 | 18 | import com.netflix.hystrix.contrib.javanica.aop.aspectj.WeavingMode; 19 | 20 | import java.util.Arrays; 21 | 22 | /** 23 | * Created by dmgcodevil 24 | */ 25 | public final class EnvUtils { 26 | 27 | private static final String WEAVING_MODE; 28 | 29 | static { 30 | WEAVING_MODE = System.getProperty("weavingMode", WeavingMode.RUNTIME.name()).toUpperCase(); 31 | } 32 | 33 | private EnvUtils(){ 34 | 35 | } 36 | 37 | public static WeavingMode getWeavingMode() { 38 | try { 39 | return WeavingMode.valueOf(EnvUtils.WEAVING_MODE); 40 | } catch (IllegalArgumentException e) { 41 | throw new IllegalArgumentException("wrong 'weavingMode' property, supported: " + Arrays.toString(WeavingMode.values()) + ", actual = " + EnvUtils.WEAVING_MODE, e); 42 | } 43 | } 44 | 45 | public static boolean isCompileWeaving() { 46 | return WeavingMode.COMPILE == getWeavingMode(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/HystrixStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.metrics; 17 | 18 | import java.util.concurrent.atomic.AtomicInteger; 19 | 20 | import rx.Observable; 21 | 22 | /** 23 | * @author justinjose28 24 | * 25 | */ 26 | public final class HystrixStream { 27 | private final Observable sampleStream; 28 | private final int pausePollerThreadDelayInMs; 29 | private final AtomicInteger concurrentConnections; 30 | 31 | public HystrixStream(Observable sampleStream, int pausePollerThreadDelayInMs, AtomicInteger concurrentConnections) { 32 | this.sampleStream = sampleStream; 33 | this.pausePollerThreadDelayInMs = pausePollerThreadDelayInMs; 34 | this.concurrentConnections = concurrentConnections; 35 | } 36 | 37 | public Observable getSampleStream() { 38 | return sampleStream; 39 | } 40 | 41 | public int getPausePollerThreadDelayInMs() { 42 | return pausePollerThreadDelayInMs; 43 | } 44 | 45 | public AtomicInteger getConcurrentConnections() { 46 | return concurrentConnections; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='hystrix' 2 | include 'hystrix-core', \ 3 | 'hystrix-examples', \ 4 | 'hystrix-examples-webapp', \ 5 | 'hystrix-contrib/hystrix-clj', \ 6 | 'hystrix-contrib/hystrix-request-servlet', \ 7 | 'hystrix-contrib/hystrix-servo-metrics-publisher', \ 8 | 'hystrix-contrib/hystrix-metrics-event-stream', \ 9 | 'hystrix-contrib/hystrix-metrics-event-stream-jaxrs', \ 10 | 'hystrix-contrib/hystrix-rx-netty-metrics-stream', \ 11 | 'hystrix-contrib/hystrix-codahale-metrics-publisher', \ 12 | 'hystrix-contrib/hystrix-yammer-metrics-publisher', \ 13 | 'hystrix-contrib/hystrix-network-auditor-agent', \ 14 | 'hystrix-contrib/hystrix-javanica', \ 15 | 'hystrix-contrib/hystrix-junit', \ 16 | 'hystrix-dashboard', \ 17 | 'hystrix-serialization' 18 | 19 | project(':hystrix-contrib/hystrix-clj').name = 'hystrix-clj' 20 | project(':hystrix-contrib/hystrix-request-servlet').name = 'hystrix-request-servlet' 21 | project(':hystrix-contrib/hystrix-servo-metrics-publisher').name = 'hystrix-servo-metrics-publisher' 22 | project(':hystrix-contrib/hystrix-metrics-event-stream').name = 'hystrix-metrics-event-stream' 23 | project(':hystrix-contrib/hystrix-metrics-event-stream-jaxrs').name = 'hystrix-metrics-event-stream-jaxrs' 24 | project(':hystrix-contrib/hystrix-rx-netty-metrics-stream').name = 'hystrix-rx-netty-metrics-stream' 25 | project(':hystrix-contrib/hystrix-codahale-metrics-publisher').name = 'hystrix-codahale-metrics-publisher' 26 | project(':hystrix-contrib/hystrix-yammer-metrics-publisher').name = 'hystrix-yammer-metrics-publisher' 27 | project(':hystrix-contrib/hystrix-network-auditor-agent').name = 'hystrix-network-auditor-agent' 28 | project(':hystrix-contrib/hystrix-javanica').name = 'hystrix-javanica' 29 | project(':hystrix-contrib/hystrix-junit').name = 'hystrix-junit' 30 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/HystrixStreamFeature.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.metrics; 17 | 18 | import javax.ws.rs.core.Feature; 19 | import javax.ws.rs.core.FeatureContext; 20 | 21 | import com.netflix.hystrix.contrib.metrics.controller.HystrixConfigSseController; 22 | import com.netflix.hystrix.contrib.metrics.controller.HystrixMetricsStreamController; 23 | import com.netflix.hystrix.contrib.metrics.controller.HystrixRequestEventsSseController; 24 | import com.netflix.hystrix.contrib.metrics.controller.HystrixUtilizationSseController; 25 | 26 | /** 27 | * @author justinjose28 28 | * 29 | */ 30 | public class HystrixStreamFeature implements Feature { 31 | 32 | @Override 33 | public boolean configure(FeatureContext context) { 34 | context.register(new HystrixMetricsStreamController()); 35 | context.register(new HystrixUtilizationSseController()); 36 | context.register(new HystrixRequestEventsSseController()); 37 | context.register(new HystrixConfigSseController()); 38 | context.register(HystrixStreamingOutputProvider.class); 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-codahale-metrics-publisher/src/test/java/com/netflix/hystrix/contrib/codahalemetricspublisher/HystrixCodaHaleMetricsPublisherCommandTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.codahalemetricspublisher; 2 | 3 | import com.codahale.metrics.Gauge; 4 | import com.codahale.metrics.MetricRegistry; 5 | import com.netflix.hystrix.HystrixCommand; 6 | import com.netflix.hystrix.HystrixCommandGroupKey; 7 | import com.netflix.hystrix.HystrixCommandKey; 8 | import com.netflix.hystrix.strategy.HystrixPlugins; 9 | import org.junit.After; 10 | import org.junit.Before; 11 | import org.junit.Test; 12 | 13 | import java.util.Map; 14 | 15 | public class HystrixCodaHaleMetricsPublisherCommandTest { 16 | private final MetricRegistry metricRegistry = new MetricRegistry(); 17 | 18 | @Before 19 | public void setup() { 20 | HystrixPlugins.getInstance().registerMetricsPublisher(new HystrixCodaHaleMetricsPublisher(metricRegistry)); 21 | } 22 | 23 | @After 24 | public void teardown() { 25 | HystrixPlugins.reset(); 26 | } 27 | 28 | @Test 29 | public void commandMaxActiveGauge() { 30 | final HystrixCommandKey hystrixCommandKey = HystrixCommandKey.Factory.asKey("test"); 31 | final HystrixCommandGroupKey hystrixCommandGroupKey = HystrixCommandGroupKey.Factory.asKey("test"); 32 | 33 | new HystrixCommand(HystrixCommand.Setter 34 | .withGroupKey(hystrixCommandGroupKey) 35 | .andCommandKey(hystrixCommandKey)) { 36 | @Override 37 | protected Void run() throws Exception { 38 | return null; 39 | } 40 | }.execute(); 41 | 42 | for (Map.Entry entry : metricRegistry.getGauges().entrySet()) { 43 | entry.getValue().getValue(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.concurrency; 17 | 18 | import com.netflix.hystrix.strategy.HystrixPlugins; 19 | 20 | /** 21 | * Interface for a variable similar to {@link ThreadLocal} but scoped at the user request level. 22 | *

23 | * Default implementation is {@link HystrixRequestVariableDefault} managed by {@link HystrixRequestContext}. 24 | *

25 | * Custom implementations can be injected using {@link HystrixPlugins} and {@link HystrixConcurrencyStrategy#getRequestVariable}. 26 | *

27 | * See JavaDoc of {@link HystrixRequestContext} for more information about functionality this enables and how to use the default implementation. 28 | * 29 | * @param 30 | * Type to be stored on the HystrixRequestVariable 31 | */ 32 | public interface HystrixRequestVariable extends HystrixRequestVariableLifecycle { 33 | 34 | /** 35 | * Retrieve current value or initialize and then return value for this variable for the current request scope. 36 | * 37 | * @return T value of variable for current request scope. 38 | */ 39 | public T get(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherCommandDefault.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixCircuitBreaker; 19 | import com.netflix.hystrix.HystrixCommandGroupKey; 20 | import com.netflix.hystrix.HystrixCommandKey; 21 | import com.netflix.hystrix.HystrixCommandMetrics; 22 | import com.netflix.hystrix.HystrixCommandProperties; 23 | 24 | /** 25 | * Default implementation of {@link HystrixMetricsPublisherCommand} that does nothing. 26 | *

27 | * See Wiki docs about plugins for more information. 28 | * 29 | * @ExcludeFromJavadoc 30 | */ 31 | public class HystrixMetricsPublisherCommandDefault implements HystrixMetricsPublisherCommand { 32 | 33 | public HystrixMetricsPublisherCommandDefault(HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { 34 | // do nothing by default 35 | } 36 | 37 | @Override 38 | public void initialize() { 39 | // do nothing by default 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/collapser/HystrixCollapserBridge.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.collapser; 17 | 18 | import java.util.Collection; 19 | 20 | import rx.Observable; 21 | 22 | import com.netflix.hystrix.HystrixCollapser.CollapsedRequest; 23 | import com.netflix.hystrix.HystrixCollapserKey; 24 | 25 | /** 26 | * Bridge between HystrixCollapser and RequestCollapser to expose 'protected' and 'private' functionality across packages. 27 | * 28 | * @param 29 | * @param 30 | * @param 31 | */ 32 | public interface HystrixCollapserBridge { 33 | 34 | Collection>> shardRequests(Collection> requests); 35 | 36 | Observable createObservableCommand(Collection> requests); 37 | 38 | Observable mapResponseToRequests(Observable batchResponse, Collection> requests); 39 | 40 | HystrixCollapserKey getCollapserKey(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/ExecutionType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command; 17 | 18 | import rx.Observable; 19 | 20 | import java.util.concurrent.Future; 21 | 22 | /** 23 | * Specifies executions types. 24 | */ 25 | public enum ExecutionType { 26 | 27 | /** 28 | * Used for asynchronous execution of command. 29 | */ 30 | ASYNCHRONOUS, 31 | 32 | /** 33 | * Used for synchronous execution of command. 34 | */ 35 | SYNCHRONOUS, 36 | 37 | /** 38 | * Reactive execution (asynchronous callback). 39 | */ 40 | OBSERVABLE; 41 | 42 | /** 43 | * Gets execution type for specified class type. 44 | * @param type the type 45 | * @return the execution type {@link ExecutionType} 46 | */ 47 | public static ExecutionType getExecutionType(Class type) { 48 | if (Future.class.isAssignableFrom(type)) { 49 | return ExecutionType.ASYNCHRONOUS; 50 | } else if (Observable.class.isAssignableFrom(type)) { 51 | return ExecutionType.OBSERVABLE; 52 | } else { 53 | return ExecutionType.SYNCHRONOUS; 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherCommand.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixCommand; 19 | 20 | /** 21 | * Metrics publisher for a {@link HystrixCommand} that will be constructed by an implementation of {@link HystrixMetricsPublisher}. 22 | *

23 | * Instantiation of implementations of this interface should NOT allocate resources that require shutdown, register listeners or other such global state changes. 24 | *

25 | * The initialize() method will be called once-and-only-once to indicate when this instance can register with external services, start publishing metrics etc. 26 | *

27 | * Doing this logic in the constructor could result in memory leaks, double-publishing and other such behavior because this can be optimistically constructed more than once and "extras" discarded with 28 | * only one actually having initialize() called on it. 29 | */ 30 | public interface HystrixMetricsPublisherCommand { 31 | 32 | // TODO should the arguments be given via initialize rather than constructor so they can't accidentally do it wrong? 33 | 34 | public void initialize(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/css/global.css: -------------------------------------------------------------------------------- 1 | @IMPORT url("resets.css"); 2 | 3 | body { 4 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 5 | } 6 | 7 | img, object, embed { 8 | max-width: 100%; 9 | } 10 | 11 | img { 12 | height: auto; 13 | } 14 | 15 | #header { 16 | background: #FFFFFF url(../images/hystrix-logo-tagline-tiny.png) no-repeat scroll 99% 0%; 17 | height: 65px; 18 | margin-bottom: 5px; 19 | } 20 | 21 | #streamHeader { 22 | height: 65px; 23 | margin-bottom: 5px; 24 | } 25 | 26 | #streamHeader h2 { 27 | float:left; 28 | color: black; 29 | position:relative; 30 | padding-left: 20px; 31 | top: 26px; 32 | font-size: 20px; 33 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 34 | } 35 | 36 | #header .header_nav { 37 | position:absolute; 38 | top:48px; 39 | right:15px; 40 | } 41 | 42 | #header .header_links { 43 | float:left; 44 | color: lightgray; 45 | font-size: 18px; 46 | top: 3px; 47 | padding-left: 10px; 48 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 49 | } 50 | 51 | #header .header_links a { 52 | color: white; 53 | } 54 | 55 | #header .header_clusters { 56 | float:left; 57 | position:relative; 58 | padding-left: 10px; 59 | top: -1px; 60 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 61 | } 62 | 63 | @media screen and (min-width: 1500px) { 64 | 65 | #header .header_nav { 66 | top:13px; 67 | right:130px; 68 | } 69 | 70 | #header { 71 | background: #FFFFFF url(../images/hystrix-logo-tagline-tiny.png) no-repeat scroll 99% 50%; 72 | height: 65px; 73 | } 74 | 75 | #streamHeader { 76 | height: 65px; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherCollapser.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixCollapser; 19 | 20 | /** 21 | * Metrics publisher for a {@link HystrixCollapser} that will be constructed by an implementation of {@link HystrixMetricsPublisher}. 22 | *

23 | * Instantiation of implementations of this interface should NOT allocate resources that require shutdown, register listeners or other such global state changes. 24 | *

25 | * The initialize() method will be called once-and-only-once to indicate when this instance can register with external services, start publishing metrics etc. 26 | *

27 | * Doing this logic in the constructor could result in memory leaks, double-publishing and other such behavior because this can be optimistically constructed more than once and "extras" discarded with 28 | * only one actually having initialize() called on it. 29 | */ 30 | public interface HystrixMetricsPublisherCollapser { 31 | 32 | // TODO should the arguments be given via initialize rather than constructor so people can't accidentally do it wrong? 33 | 34 | public void initialize(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherThreadPool.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.metrics; 17 | 18 | import com.netflix.hystrix.HystrixThreadPool; 19 | 20 | /** 21 | * Metrics publisher for a {@link HystrixThreadPool} that will be constructed by an implementation of {@link HystrixMetricsPublisher}. 22 | *

23 | * Instantiation of implementations of this interface should NOT allocate resources that require shutdown, register listeners or other such global state changes. 24 | *

25 | * The initialize() method will be called once-and-only-once to indicate when this instance can register with external services, start publishing metrics etc. 26 | *

27 | * Doing this logic in the constructor could result in memory leaks, double-publishing and other such behavior because this can be optimistically constructed more than once and "extras" discarded with 28 | * only one actually having initialize() called on it. 29 | */ 30 | public interface HystrixMetricsPublisherThreadPool { 31 | 32 | // TODO should the arguments be given via initialize rather than constructor so people can't accidentally do it wrong? 33 | 34 | public void initialize(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-clj/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven{ 5 | name 'clojars' 6 | url 'http://clojars.org/repo' 7 | } 8 | } 9 | dependencies { 10 | classpath 'com.netflix.nebula:nebula-clojure-plugin:4.0.1' 11 | } 12 | } 13 | apply plugin: 'nebula.clojure' // this is a wrapper around clojuresque to make it behave well with other plugins 14 | 15 | repositories { 16 | mavenCentral() 17 | clojarsRepo() 18 | } 19 | 20 | dependencies { 21 | compileApi project(':hystrix-core') 22 | compile 'org.clojure:clojure:1.7.0' 23 | } 24 | 25 | /* 26 | * Add Counterclockwise and include 'provided' dependencies 27 | */ 28 | eclipse { 29 | project { 30 | natures "ccw.nature" 31 | } 32 | } 33 | 34 | 35 | //////////////////////////////////////////////////////////////////////////////// 36 | // Define a task that runs an nrepl server. The port is given with the nreplPort 37 | // property: 38 | // gradlew nrepl -PnreplPort=9999 39 | // or put the property in ~/.gradle/gradle.properties 40 | def nreplPort = 9999 // hardcoding to 9999 until figuring out how to make this not break Eclipse project import when the property isn't defined 41 | configurations { nrepl } 42 | dependencies { nrepl 'org.clojure:tools.nrepl:0.2.1' } 43 | task nrepl(type: JavaExec) { 44 | classpath configurations.nrepl.asPath, 45 | project.sourceSets.main.clojure.srcDirs, 46 | project.sourceSets.test.clojure.srcDirs, 47 | sourceSets.main.runtimeClasspath 48 | main = "clojure.main" 49 | args '--eval', "(ns gradle-nrepl (:require [clojure.tools.nrepl.server :refer (start-server stop-server)]))", 50 | '--eval', "(println \"Starting nrepl server on port $nreplPort\")", 51 | '--eval', "(def server (start-server :port $nreplPort))" 52 | } 53 | 54 | // vim:ft=groovy 55 | -------------------------------------------------------------------------------- /hystrix-core/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'osgi' 2 | apply plugin: 'me.champeau.gradle.jmh' 3 | 4 | dependencies { 5 | compileApi 'com.netflix.archaius:archaius-core:0.4.1' 6 | compileApi 'io.reactivex:rxjava:1.2.0' 7 | compile 'org.slf4j:slf4j-api:1.7.0' 8 | compileApi 'org.hdrhistogram:HdrHistogram:2.1.9' 9 | testCompile 'junit:junit-dep:4.10' 10 | testCompile project(':hystrix-junit') 11 | } 12 | 13 | 14 | javadoc { 15 | // the exclude isn't working, nor is there a subPackages options as docs suggest there should be 16 | // we do not want the com.netflix.hystrix.util package include 17 | exclude '**/util/**' 18 | 19 | options { 20 | doclet = "org.benjchristensen.doclet.DocletExclude" 21 | docletpath = [rootProject.file('./gradle/doclet-exclude.jar')] 22 | stylesheetFile = rootProject.file('./gradle/javadocStyleSheet.css') 23 | windowTitle = "Hystrix Javadoc ${project.version}" 24 | } 25 | options.addStringOption('top').value = '

Hystrix: Latency and Fault Tolerance for Distributed Systems

' 26 | } 27 | 28 | jar { 29 | manifest { 30 | name = 'hystrix-core' 31 | instruction 'Bundle-Vendor', 'Netflix' 32 | instruction 'Bundle-DocURL', 'https://github.com/Netflix/Hystrix' 33 | instruction 'Import-Package', '!org.junit,!junit.framework,!org.mockito.*,*' 34 | instruction 'Eclipse-ExtensibleAPI', 'true' 35 | instruction 'Embed-Dependency', '*;scope=compile' 36 | } 37 | } 38 | 39 | jmh { 40 | fork = 10 41 | iterations = 3 42 | jmhVersion = '1.15' 43 | profilers = ['gc'] 44 | threads = 8 45 | warmup = '1s' 46 | warmupBatchSize = 1 47 | warmupIterations = 5 48 | } 49 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/js/jquery.tinysort.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery TinySort - A plugin to sort child nodes by (sub) contents or attributes. 3 | * 4 | * Version: 1.0.5 5 | * 6 | * Copyright (c) 2008-2011 Ron Valstar http://www.sjeiti.com/ 7 | * 8 | * Dual licensed under the MIT and GPL licenses: 9 | * http://www.opensource.org/licenses/mit-license.php 10 | * http://www.gnu.org/licenses/gpl.html 11 | */ 12 | (function(b){b.tinysort={id:"TinySort",version:"1.0.5",copyright:"Copyright (c) 2008-2011 Ron Valstar",uri:"http://tinysort.sjeiti.com/",defaults:{order:"asc",attr:"",place:"start",returns:false,useVal:false}};b.fn.extend({tinysort:function(h,j){if(h&&typeof(h)!="string"){j=h;h=null}var e=b.extend({},b.tinysort.defaults,j);var p={};this.each(function(t){var v=(!h||h=="")?b(this):b(this).find(h);var u=e.order=="rand"?""+Math.random():(e.attr==""?(e.useVal?v.val():v.text()):v.attr(e.attr));var s=b(this).parent();if(!p[s]){p[s]={s:[],n:[]}}if(v.length>0){p[s].s.push({s:u,e:b(this),n:t})}else{p[s].n.push({e:b(this),n:t})}});for(var g in p){var d=p[g];d.s.sort(function k(t,s){var i=t.s.toLowerCase?t.s.toLowerCase():t.s;var u=s.s.toLowerCase?s.s.toLowerCase():s.s;if(c(t.s)&&c(s.s)){i=parseFloat(t.s);u=parseFloat(s.s)}return(e.order=="asc"?1:-1)*(iu?1:0))})}var m=[];for(var g in p){var d=p[g];var n=[];var f=b(this).length;switch(e.place){case"first":b.each(d.s,function(s,t){f=Math.min(f,t.n)});break;case"org":b.each(d.s,function(s,t){n.push(t.n)});break;case"end":f=d.n.length;break;default:f=0}var q=[0,0];for(var l=0;l=f&&l0?d[1]:false}function a(e,f){var d=false;b.each(e,function(h,g){if(!d){d=g==f}});return d}b.fn.TinySort=b.fn.Tinysort=b.fn.tsort=b.fn.tinysort})(jQuery); -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-junit/src/main/java/com/hystrix/junit/HystrixRequestContextRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.hystrix.junit; 17 | 18 | import com.netflix.hystrix.Hystrix; 19 | import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext; 20 | import org.junit.rules.ExternalResource; 21 | 22 | /** 23 | * JUnit rule to be used to simplify tests that require a HystrixRequestContext. 24 | * 25 | * Example of usage: 26 | * 27 | *
28 | *
29 |  *     @Rule
30 |  *     public HystrixRequestContextRule context = new HystrixRequestContextRule();
31 |  * 
32 | *
33 | * 34 | */ 35 | public final class HystrixRequestContextRule extends ExternalResource { 36 | private HystrixRequestContext context; 37 | 38 | @Override 39 | protected void before() { 40 | this.context = HystrixRequestContext.initializeContext(); 41 | Hystrix.reset(); 42 | } 43 | 44 | @Override 45 | protected void after() { 46 | if (this.context != null) { 47 | this.context.shutdown(); 48 | this.context = null; 49 | } 50 | } 51 | 52 | public HystrixRequestContext context() { 53 | return this.context; 54 | } 55 | 56 | public void reset() { 57 | after(); 58 | before(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/CommonUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.utils; 17 | 18 | import com.netflix.hystrix.contrib.javanica.command.MetaHolder; 19 | import org.apache.commons.lang3.ArrayUtils; 20 | 21 | import java.util.Arrays; 22 | 23 | /** 24 | * Created by dmgcodevil. 25 | */ 26 | public final class CommonUtils { 27 | 28 | private CommonUtils(){ 29 | 30 | } 31 | 32 | public static Object[] createArgsForFallback(MetaHolder metaHolder, Throwable exception) { 33 | return createArgsForFallback(metaHolder.getArgs(), metaHolder, exception); 34 | } 35 | 36 | public static Object[] createArgsForFallback(Object[] args, MetaHolder metaHolder, Throwable exception) { 37 | if (metaHolder.isExtendedFallback()) { 38 | if (metaHolder.isExtendedParentFallback()) { 39 | args[args.length - 1] = exception; 40 | } else { 41 | args = Arrays.copyOf(args, args.length + 1); 42 | args[args.length - 1] = exception; 43 | } 44 | } else { 45 | if (metaHolder.isExtendedParentFallback()) { 46 | args = ArrayUtils.remove(args, args.length - 1); 47 | } 48 | } 49 | return args; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/HystrixCachedObservable.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix; 2 | 3 | import rx.Observable; 4 | import rx.Subscription; 5 | import rx.functions.Action0; 6 | import rx.subjects.ReplaySubject; 7 | 8 | public class HystrixCachedObservable { 9 | protected final Subscription originalSubscription; 10 | protected final Observable cachedObservable; 11 | private volatile int outstandingSubscriptions = 0; 12 | 13 | protected HystrixCachedObservable(final Observable originalObservable) { 14 | ReplaySubject replaySubject = ReplaySubject.create(); 15 | this.originalSubscription = originalObservable 16 | .subscribe(replaySubject); 17 | 18 | this.cachedObservable = replaySubject 19 | .doOnUnsubscribe(new Action0() { 20 | @Override 21 | public void call() { 22 | outstandingSubscriptions--; 23 | if (outstandingSubscriptions == 0) { 24 | originalSubscription.unsubscribe(); 25 | } 26 | } 27 | }) 28 | .doOnSubscribe(new Action0() { 29 | @Override 30 | public void call() { 31 | outstandingSubscriptions++; 32 | } 33 | }); 34 | } 35 | 36 | public static HystrixCachedObservable from(Observable o, AbstractCommand originalCommand) { 37 | return new HystrixCommandResponseFromCache(o, originalCommand); 38 | } 39 | 40 | public static HystrixCachedObservable from(Observable o) { 41 | return new HystrixCachedObservable(o); 42 | } 43 | 44 | public Observable toObservable() { 45 | return cachedObservable; 46 | } 47 | 48 | public void unsubscribe() { 49 | originalSubscription.unsubscribe(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/fallback/DefaultFallbackTest.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.contrib.javanica.test.spring.fallback; 2 | 3 | import com.netflix.hystrix.contrib.javanica.test.common.fallback.BasicDefaultFallbackTest; 4 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Configurable; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.test.context.ContextConfiguration; 10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 11 | 12 | /** 13 | * Created by dmgcodevil. 14 | */ 15 | @RunWith(SpringJUnit4ClassRunner.class) 16 | @ContextConfiguration(classes = {AopCglibConfig.class, DefaultFallbackTest.Config.class}) 17 | public class DefaultFallbackTest extends BasicDefaultFallbackTest { 18 | 19 | @Autowired 20 | private ServiceWithDefaultFallback serviceWithDefaultFallback; 21 | @Autowired 22 | private ServiceWithDefaultCommandFallback serviceWithDefaultCommandFallback; 23 | 24 | 25 | @Override 26 | protected ServiceWithDefaultFallback createServiceWithDefaultFallback() { 27 | return serviceWithDefaultFallback; 28 | } 29 | 30 | @Override 31 | protected ServiceWithDefaultCommandFallback serviceWithDefaultCommandFallback() { 32 | return serviceWithDefaultCommandFallback; 33 | } 34 | 35 | @Configurable 36 | public static class Config { 37 | @Bean 38 | public ServiceWithDefaultFallback serviceWithDefaultFallback() { 39 | return new ServiceWithDefaultFallback(); 40 | } 41 | 42 | @Bean 43 | public ServiceWithDefaultCommandFallback serviceWithDefaultCommandFallback() { 44 | return new ServiceWithDefaultCommandFallback(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/DefaultHystrixGeneratedCacheKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.cache; 17 | 18 | import com.google.common.base.Objects; 19 | 20 | /** 21 | * Default implementation of {@link HystrixGeneratedCacheKey}. 22 | * 23 | * @author dmgcodevil 24 | */ 25 | public class DefaultHystrixGeneratedCacheKey implements HystrixGeneratedCacheKey { 26 | 27 | /** 28 | * Means "do not cache". 29 | */ 30 | public static final DefaultHystrixGeneratedCacheKey EMPTY = new DefaultHystrixGeneratedCacheKey(null); 31 | 32 | private String cacheKey; 33 | 34 | public DefaultHystrixGeneratedCacheKey(String cacheKey) { 35 | this.cacheKey = cacheKey; 36 | } 37 | 38 | @Override 39 | public String getCacheKey() { 40 | return cacheKey; 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | return Objects.hashCode(cacheKey); 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) 51 | return true; 52 | if (o == null || getClass() != o.getClass()) 53 | return false; 54 | 55 | DefaultHystrixGeneratedCacheKey that = (DefaultHystrixGeneratedCacheKey) o; 56 | 57 | return Objects.equal(this.cacheKey, that.cacheKey); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/UserAccount.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.examples.demo; 17 | 18 | /** 19 | * Simple POJO to represent a user and their metadata. 20 | */ 21 | public class UserAccount { 22 | 23 | private final int userId; 24 | private final String name; 25 | private final int accountType; 26 | private final boolean isFeatureXenabled; 27 | private final boolean isFeatureYenabled; 28 | private final boolean isFeatureZenabled; 29 | 30 | public UserAccount(int userId, String name, int accountType, boolean x, boolean y, boolean z) { 31 | this.userId = userId; 32 | this.name = name; 33 | this.accountType = accountType; 34 | this.isFeatureXenabled = x; 35 | this.isFeatureYenabled = y; 36 | this.isFeatureZenabled = z; 37 | } 38 | 39 | public int getUserId() { 40 | return userId; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public int getAccountType() { 48 | return accountType; 49 | } 50 | 51 | public boolean isFeatureXenabled() { 52 | return isFeatureXenabled; 53 | } 54 | 55 | public boolean isFeatureYenabled() { 56 | return isFeatureYenabled; 57 | } 58 | 59 | public boolean isFeatureZenabled() { 60 | return isFeatureZenabled; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableLifecycle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.strategy.concurrency; 17 | 18 | /** 19 | * Interface for lifecycle methods that are then executed by an implementation of {@link HystrixRequestVariable}. 20 | * 21 | * @param 22 | */ 23 | public interface HystrixRequestVariableLifecycle { 24 | 25 | /** 26 | * Invoked when {@link HystrixRequestVariable#get()} is first called. 27 | *

28 | * When using the default implementation this is invoked when {@link HystrixRequestVariableDefault#get()} is called. 29 | * 30 | * @return T with initial value or null if none. 31 | */ 32 | public T initialValue(); 33 | 34 | /** 35 | * Invoked when request scope is shutdown to allow for cleanup. 36 | *

37 | * When using the default implementation this is invoked when {@link HystrixRequestContext#shutdown()} is called. 38 | *

39 | * The {@link HystrixRequestVariable#get()} method should not be called from within this method as it will result in {@link #initialValue()} being called again. 40 | * 41 | * @param value 42 | * of request variable to allow cleanup activity. 43 | *

44 | * If nothing needs to be cleaned up then nothing needs to be done in this method. 45 | */ 46 | public void shutdown(T value); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/annotation/CacheKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.cache.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Marks a method argument as part of the cache key. 26 | * If no arguments are marked all arguments are used. 27 | * If {@link CacheResult} or {@link CacheRemove} annotation has specified cacheKeyMethod then 28 | * a method arguments will not be used to build cache key even if they annotated with {@link CacheKey}. 29 | * 30 | * @author dmgcodevil 31 | */ 32 | @Target({ElementType.PARAMETER}) 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Documented 35 | public @interface CacheKey { 36 | 37 | /** 38 | * Allows specify name of a certain argument property. 39 | * for example: @CacheKey("id") User user, 40 | * or in case composite property: @CacheKey("profile.name") User user. 41 | * null properties are ignored, i.e. if profile is null 42 | * then result of @CacheKey("profile.name") User user will be empty string. 43 | * 44 | * @return name of an argument property 45 | */ 46 | String value() default ""; 47 | } 48 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/configuration/command/CommandPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.configuration.command; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.command.BasicCommandPropertiesTest; 19 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 20 | import org.junit.runner.RunWith; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.beans.factory.annotation.Configurable; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.test.context.ContextConfiguration; 25 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 26 | 27 | @RunWith(SpringJUnit4ClassRunner.class) 28 | @ContextConfiguration(classes = {AopCglibConfig.class, CommandPropertiesTest.CommandPropertiesTestConfig.class}) 29 | public class CommandPropertiesTest extends BasicCommandPropertiesTest { 30 | 31 | @Autowired 32 | private BasicCommandPropertiesTest.UserService userService; 33 | 34 | @Override 35 | protected UserService createUserService() { 36 | return userService; 37 | } 38 | 39 | 40 | @Configurable 41 | public static class CommandPropertiesTestConfig { 42 | 43 | @Bean 44 | public UserService userService() { 45 | return new UserService(); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/java/com/netflix/hystrix/dashboard/stream/EurekaInfoServlet.java: -------------------------------------------------------------------------------- 1 | package com.netflix.hystrix.dashboard.stream; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.apache.commons.io.IOUtils; 11 | 12 | /** 13 | * Copyright 2013 Netflix, Inc. 14 | * 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | 28 | /** 29 | * Servlet that calls eureka REST api in order to get instances information.
30 | * You need provide a url parameter. i.e: eureka?url=http://127.0.0.1:8080/eureka/v2/apps 31 | * 32 | * @author diegopacheco 33 | * 34 | */ 35 | public class EurekaInfoServlet extends HttpServlet { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | 41 | String uri = request.getParameter("url"); 42 | if (uri==null || "".equals(uri)) response.getOutputStream().write("Error. You need supply a valid eureka URL ".getBytes()); 43 | 44 | try{ 45 | response.setContentType("application/xml"); 46 | response.setHeader("Content-Encoding", "gzip"); 47 | IOUtils.copy( UrlUtils.readXmlInputStream(uri) ,response.getOutputStream()); 48 | }catch(Exception e){ 49 | response.getOutputStream().write(("Error. You need supply a valid eureka URL. Ex: " + e + "").getBytes()); 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/metric/sample/HystrixUtilization.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.metric.sample; 17 | 18 | import com.netflix.hystrix.HystrixCommandKey; 19 | import com.netflix.hystrix.HystrixThreadPoolKey; 20 | 21 | import java.util.Map; 22 | 23 | public class HystrixUtilization { 24 | private final Map commandUtilizationMap; 25 | private final Map threadPoolUtilizationMap; 26 | 27 | public HystrixUtilization(Map commandUtilizationMap, Map threadPoolUtilizationMap) { 28 | this.commandUtilizationMap = commandUtilizationMap; 29 | this.threadPoolUtilizationMap = threadPoolUtilizationMap; 30 | } 31 | 32 | public static HystrixUtilization from(Map commandUtilizationMap, 33 | Map threadPoolUtilizationMap) { 34 | return new HystrixUtilization(commandUtilizationMap, threadPoolUtilizationMap); 35 | } 36 | 37 | public Map getCommandUtilizationMap() { 38 | return commandUtilizationMap; 39 | } 40 | 41 | public Map getThreadPoolUtilizationMap() { 42 | return threadPoolUtilizationMap; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /hystrix-dashboard/src/main/webapp/monitor/monitor.css: -------------------------------------------------------------------------------- 1 | .container { 2 | padding-left: 20px; 3 | padding-right: 20px; 4 | } 5 | 6 | .row { 7 | width: 100%; 8 | margin: 0 auto; 9 | overflow: hidden; 10 | } 11 | 12 | .spacer { 13 | width: 100%; 14 | margin: 0 auto; 15 | padding-top:4px; 16 | clear:both; 17 | } 18 | 19 | 20 | .last { 21 | margin-right: 0px; 22 | } 23 | 24 | .menubar { 25 | overflow: hidden; 26 | border-bottom: 1px solid black; 27 | } 28 | 29 | .menubar div { 30 | padding-bottom:5px; 31 | 32 | margin: 0 auto; 33 | overflow: hidden; 34 | 35 | font-size: 80%; 36 | font-family:'Bookman Old Style',Bookman,'URW Bookman L','Palatino Linotype',serif; 37 | 38 | float:left; 39 | } 40 | 41 | .menubar .title { 42 | float: left; 43 | padding-right: 20px; 44 | 45 | font-size: 110%; 46 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 47 | font-weight: bold; 48 | 49 | vertical-align: bottom; 50 | } 51 | 52 | .menubar .menu_actions { 53 | float: left; 54 | position:relative; 55 | top: 4px; 56 | } 57 | 58 | .menubar .menu_legend { 59 | float: right; 60 | position:relative; 61 | top: 4px; 62 | 63 | } 64 | 65 | h3.sectionHeader { 66 | color: black; 67 | font-size: 110%; 68 | padding-top: 4px; 69 | padding-bottom: 4px; 70 | padding-left: 8px; 71 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 72 | background: lightgrey; 73 | } 74 | 75 | .success { 76 | color: green; 77 | } 78 | 79 | .shortCircuited { 80 | color: blue; 81 | } 82 | 83 | .timeout { 84 | color: #FF9900; /* shade of orange */ 85 | } 86 | 87 | .failure { 88 | color: red; 89 | } 90 | 91 | .rejected { 92 | color: purple; 93 | } 94 | 95 | .exceptionsThrown { 96 | color: brown; 97 | } 98 | 99 | .badRequest { 100 | color: lightSeaGreen; 101 | } 102 | 103 | @media screen and (max-width: 1100px) { 104 | .container { 105 | padding-left: 5px; 106 | padding-right: 5px; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/CommandAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.command; 17 | 18 | import com.netflix.hystrix.contrib.javanica.exception.CommandActionExecutionException; 19 | 20 | /** 21 | * Simple action to encapsulate some logic to process it in a Hystrix command. 22 | */ 23 | public interface CommandAction { 24 | 25 | MetaHolder getMetaHolder(); 26 | 27 | /** 28 | * Executes action in accordance with the given execution type. 29 | * 30 | * @param executionType the execution type 31 | * @return result of execution 32 | * @throws com.netflix.hystrix.contrib.javanica.exception.CommandActionExecutionException 33 | */ 34 | Object execute(ExecutionType executionType) throws CommandActionExecutionException; 35 | 36 | /** 37 | * Executes action with parameters in accordance with the given execution ty 38 | * 39 | * @param executionType the execution type 40 | * @param args the parameters of the action 41 | * @return result of execution 42 | * @throws com.netflix.hystrix.contrib.javanica.exception.CommandActionExecutionException 43 | */ 44 | Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException; 45 | 46 | /** 47 | * Gets action name. Useful for debugging. 48 | * 49 | * @return the action name 50 | */ 51 | String getActionName(); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/configuration/collapser/CollapserPropertiesTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Netflix, Inc. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix.contrib.javanica.test.spring.configuration.collapser; 17 | 18 | import com.netflix.hystrix.contrib.javanica.test.common.configuration.collapser.BasicCollapserPropertiesTest; 19 | import com.netflix.hystrix.contrib.javanica.test.spring.conf.AopCglibConfig; 20 | import org.junit.runner.RunWith; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.beans.factory.annotation.Configurable; 23 | import org.springframework.context.annotation.Bean; 24 | import org.springframework.test.context.ContextConfiguration; 25 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 26 | 27 | @RunWith(SpringJUnit4ClassRunner.class) 28 | @ContextConfiguration(classes = {AopCglibConfig.class, CollapserPropertiesTest.CollapserPropertiesTestConfig.class}) 29 | public class CollapserPropertiesTest extends BasicCollapserPropertiesTest { 30 | 31 | @Autowired 32 | private UserService userService; 33 | 34 | @Override 35 | protected UserService createUserService() { 36 | return userService; 37 | } 38 | 39 | 40 | @Configurable 41 | public static class CollapserPropertiesTestConfig { 42 | 43 | @Bean 44 | public BasicCollapserPropertiesTest.UserService userService() { 45 | return new UserService(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /hystrix-core/src/main/java/com/netflix/hystrix/HystrixMetrics.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Netflix, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.netflix.hystrix; 17 | 18 | import com.netflix.hystrix.util.HystrixRollingNumber; 19 | import com.netflix.hystrix.util.HystrixRollingNumberEvent; 20 | 21 | /** 22 | * Abstract base class for Hystrix metrics 23 | */ 24 | public abstract class HystrixMetrics { 25 | 26 | protected final HystrixRollingNumber counter; 27 | 28 | protected HystrixMetrics(HystrixRollingNumber counter) { 29 | this.counter = counter; 30 | } 31 | /** 32 | * Get the cumulative count since the start of the application for the given {@link HystrixRollingNumberEvent}. 33 | * 34 | * @param event 35 | * {@link HystrixRollingNumberEvent} of the event to retrieve a sum for 36 | * @return long cumulative count 37 | */ 38 | public long getCumulativeCount(HystrixRollingNumberEvent event) { 39 | return counter.getCumulativeSum(event); 40 | } 41 | 42 | /** 43 | * Get the rolling count for the given {@link HystrixRollingNumberEvent}. 44 | *

45 | * The rolling window is defined by {@link HystrixCommandProperties#metricsRollingStatisticalWindowInMilliseconds()}. 46 | * 47 | * @param event 48 | * {@link HystrixRollingNumberEvent} of the event to retrieve a sum for 49 | * @return long rolling count 50 | */ 51 | public long getRollingCount(HystrixRollingNumberEvent event) { 52 | return counter.getRollingSum(event); 53 | } 54 | 55 | } 56 | --------------------------------------------------------------------------------