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 |
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