Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
5fe55b47
Commit
5fe55b47
authored
Nov 29, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正Hystrix下的Bug
parent
8ca832c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/context/RestStrategyContext.java
+4
-4
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/context/ServiceStrategyContextHolder.java
+2
-2
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/wrapper/DefaultCallableWrapper.java
+2
-2
No files found.
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/context/RestStrategyContext.java
View file @
5fe55b47
...
@@ -13,7 +13,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
...
@@ -13,7 +13,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import
org.apache.commons.lang3.builder.HashCodeBuilder
;
import
org.apache.commons.lang3.builder.HashCodeBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.springframework.web.context.request.
Servlet
RequestAttributes
;
import
org.springframework.web.context.request.RequestAttributes
;
public
class
RestStrategyContext
{
public
class
RestStrategyContext
{
private
static
final
ThreadLocal
<
RestStrategyContext
>
THREAD_LOCAL
=
new
InheritableThreadLocal
<
RestStrategyContext
>()
{
private
static
final
ThreadLocal
<
RestStrategyContext
>
THREAD_LOCAL
=
new
InheritableThreadLocal
<
RestStrategyContext
>()
{
...
@@ -31,13 +31,13 @@ public class RestStrategyContext {
...
@@ -31,13 +31,13 @@ public class RestStrategyContext {
THREAD_LOCAL
.
remove
();
THREAD_LOCAL
.
remove
();
}
}
private
Servlet
RequestAttributes
requestAttributes
;
private
RequestAttributes
requestAttributes
;
public
Servlet
RequestAttributes
getRequestAttributes
()
{
public
RequestAttributes
getRequestAttributes
()
{
return
requestAttributes
;
return
requestAttributes
;
}
}
public
void
setRequestAttributes
(
Servlet
RequestAttributes
requestAttributes
)
{
public
void
setRequestAttributes
(
RequestAttributes
requestAttributes
)
{
this
.
requestAttributes
=
requestAttributes
;
this
.
requestAttributes
=
requestAttributes
;
}
}
...
...
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/context/ServiceStrategyContextHolder.java
View file @
5fe55b47
...
@@ -25,9 +25,9 @@ public class ServiceStrategyContextHolder {
...
@@ -25,9 +25,9 @@ public class ServiceStrategyContextHolder {
public
ServletRequestAttributes
getRestAttributes
()
{
public
ServletRequestAttributes
getRestAttributes
()
{
Boolean
hystrixThreadlocalSupported
=
environment
.
getProperty
(
StrategyConstant
.
SPRING_APPLICATION_STRATEGY_HYSTRIX_THREADLOCAL_SUPPORTED
,
Boolean
.
class
,
Boolean
.
FALSE
);
Boolean
hystrixThreadlocalSupported
=
environment
.
getProperty
(
StrategyConstant
.
SPRING_APPLICATION_STRATEGY_HYSTRIX_THREADLOCAL_SUPPORTED
,
Boolean
.
class
,
Boolean
.
FALSE
);
if
(
hystrixThreadlocalSupported
)
{
if
(
hystrixThreadlocalSupported
)
{
return
RestStrategyContext
.
getCurrentContext
().
getRequestAttributes
();
return
(
ServletRequestAttributes
)
RestStrategyContext
.
getCurrentContext
().
getRequestAttributes
();
}
else
{
}
else
{
return
(
ServletRequestAttributes
)
RequestContextHolder
.
curren
tRequestAttributes
();
return
(
ServletRequestAttributes
)
RequestContextHolder
.
ge
tRequestAttributes
();
}
}
}
}
...
...
discovery-plugin-strategy-starter-service/src/main/java/com/nepxion/discovery/plugin/strategy/service/wrapper/DefaultCallableWrapper.java
View file @
5fe55b47
...
@@ -12,8 +12,8 @@ package com.nepxion.discovery.plugin.strategy.service.wrapper;
...
@@ -12,8 +12,8 @@ package com.nepxion.discovery.plugin.strategy.service.wrapper;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
com.nepxion.discovery.plugin.strategy.service.context.RestStrategyContext
;
import
com.nepxion.discovery.plugin.strategy.service.context.RestStrategyContext
;
import
com.nepxion.discovery.plugin.strategy.wrapper.CallableWrapper
;
import
com.nepxion.discovery.plugin.strategy.wrapper.CallableWrapper
;
...
@@ -21,7 +21,7 @@ import com.nepxion.discovery.plugin.strategy.wrapper.CallableWrapper;
...
@@ -21,7 +21,7 @@ import com.nepxion.discovery.plugin.strategy.wrapper.CallableWrapper;
public
class
DefaultCallableWrapper
implements
CallableWrapper
{
public
class
DefaultCallableWrapper
implements
CallableWrapper
{
@Override
@Override
public
<
T
>
Callable
<
T
>
wrapCallable
(
Callable
<
T
>
delegate
)
{
public
<
T
>
Callable
<
T
>
wrapCallable
(
Callable
<
T
>
delegate
)
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
curren
tRequestAttributes
();
RequestAttributes
requestAttributes
=
RequestContextHolder
.
ge
tRequestAttributes
();
return
new
Callable
<
T
>()
{
return
new
Callable
<
T
>()
{
@Override
@Override
...
...
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