Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
5bd32c01
Commit
5bd32c01
authored
Oct 08, 2014
by
Christian Dupuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shutdown hook for Hystrix to reset internal state and thread pool.
Additionally added some license headers and @author tags. fixes #17
parent
2505b437
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
6 deletions
+98
-6
EnableHystrix.java
.../springframework/cloud/netflix/hystrix/EnableHystrix.java
+17
-1
HystrixConfiguration.java
...framework/cloud/netflix/hystrix/HystrixConfiguration.java
+33
-1
HystrixConfigurationSelector.java
...k/cloud/netflix/hystrix/HystrixConfigurationSelector.java
+17
-1
HystrixConfigurer.java
...ingframework/cloud/netflix/hystrix/HystrixConfigurer.java
+15
-0
HystrixStreamEndpoint.java
...ramework/cloud/netflix/hystrix/HystrixStreamEndpoint.java
+16
-3
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/EnableHystrix.java
View file @
5bd32c01
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
org.springframework.context.annotation.AdviceMode
;
...
...
@@ -14,7 +29,8 @@ import java.lang.annotation.*;
@Documented
@Import
(
HystrixConfigurationSelector
.
class
)
public
@interface
EnableHystrix
{
/**
/**
* Indicate whether subclass-based (CGLIB) proxies are to be created ({@code true}) as
* opposed to standard Java interface-based proxies ({@code false}). The default is
* {@code false}. <strong>Applicable only if {@link #mode()} is set to
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConfiguration.java
View file @
5bd32c01
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
java.io.IOException
;
...
...
@@ -9,6 +24,7 @@ import java.util.Set;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
@@ -23,12 +39,14 @@ import org.springframework.util.Assert;
import
org.springframework.util.CollectionUtils
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.netflix.hystrix.Hystrix
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.MetricsAsJsonPollerListener
;
/**
* @author Spencer Gibb
* @author Christian Dupuis
*/
@Configuration
public
class
HystrixConfiguration
implements
ImportAware
{
...
...
@@ -36,9 +54,14 @@ public class HystrixConfiguration implements ImportAware {
private
AnnotationAttributes
enableHystrix
;
@Bean
HystrixCommandAspect
hystrixCommandAspect
()
{
public
HystrixCommandAspect
hystrixCommandAspect
()
{
return
new
HystrixCommandAspect
();
}
@Bean
public
HystrixShutdownHook
hystrixShutdownHook
()
{
return
new
HystrixShutdownHook
();
}
@Bean
// TODO: add enable/disable
...
...
@@ -169,4 +192,13 @@ public class HystrixConfiguration implements ImportAware {
}
}
private
class
HystrixShutdownHook
implements
DisposableBean
{
@Override
public
void
destroy
()
throws
Exception
{
Hystrix
.
reset
();
}
}
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurationSelector.java
View file @
5bd32c01
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
org.springframework.context.annotation.AdviceMode
;
...
...
@@ -8,7 +23,8 @@ import org.springframework.context.annotation.AutoProxyRegistrar;
* @author Spencer Gibb
*/
public
class
HystrixConfigurationSelector
extends
AdviceModeImportSelector
<
EnableHystrix
>
{
/**
/**
* The name of the AspectJ transaction management @{@code Configuration} class.
*/
private
static
final
String
TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME
=
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurer.java
View file @
5bd32c01
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
/**
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpoint.java
View file @
5bd32c01
/*
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
org.springframework.cloud.netflix.endpoint.ServletWrappingEndpoint
;
...
...
@@ -5,9 +20,7 @@ import org.springframework.cloud.netflix.endpoint.ServletWrappingEndpoint;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
/**
* User: spencergibb
* Date: 4/22/14
* Time: 3:16 PM
* @author Spencer Gibb
*/
public
class
HystrixStreamEndpoint
extends
ServletWrappingEndpoint
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment