Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java.lang.NullPointerException: null
- at com.netflix.hystrix.HystrixCollapser$3.call(HystrixCollapser.java:398) ~[hystrix-core-1.5.12.jar:1.5.12]
- at com.netflix.hystrix.HystrixCollapser$3.call(HystrixCollapser.java:382) ~[hystrix-core-1.5.12.jar:1.5.12]
- at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[rxjava-1.2.0.jar:1.2.0]
- at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.2.0.jar:1.2.0]
- at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar:1.2.0]
- @EnableCircuitBreaker
- @EnableEurekaClient
- @SpringBootApplication
- public class EurekaClient1Application {
- @LoadBalanced
- @Bean
- public RestTemplate restTemplate() {
- return new RestTemplate();
- }
- public static void main(String[] args) {
- SpringApplication.run(EurekaClient1Application.class, args);
- }
- }
- @HystrixCollapser(batchMethod = "getAll")
- public Integer get(Integer index) {
- logger.info("invoke getOne !!!!!!!!!!!!");
- return restTemplate.getForObject("http://eureka-client-2/getOne/{1}",Integer.class,index);
- }
- @HystrixCommand(fallbackMethod = "getAllError")
- public List<Integer> getAll(List<Integer> indices) {
- logger.info("invoke multi !!!!!!!!!!!!!!!");
- final String ids = indices.toString().replaceAll("\[|\]", "");
- return restTemplate.getForObject("http://eureka-client-2/getMulti?ids={1}", List.class, ids);
- }
- private List<Integer> getAllError(List<Integer> indices) {
- return Collections.emptyList();
- }
- public class HystrixLifecycleForwardingRequestVariable<T> extends HystrixRequestVariableDefault<T> {
- .....
- @Override
- public T get() {
- if (!HystrixRequestContext.isCurrentThreadInitialized()) {
- return null;
- }
- return super.get();
- }
Add Comment
Please, Sign In to add comment