Guest User

Untitled

a guest
Mar 18th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. java.lang.NullPointerException: null
  2. at com.netflix.hystrix.HystrixCollapser$3.call(HystrixCollapser.java:398) ~[hystrix-core-1.5.12.jar:1.5.12]
  3. at com.netflix.hystrix.HystrixCollapser$3.call(HystrixCollapser.java:382) ~[hystrix-core-1.5.12.jar:1.5.12]
  4. at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[rxjava-1.2.0.jar:1.2.0]
  5. at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[rxjava-1.2.0.jar:1.2.0]
  6. at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[rxjava-1.2.0.jar:1.2.0]
  7.  
  8. @EnableCircuitBreaker
  9. @EnableEurekaClient
  10. @SpringBootApplication
  11. public class EurekaClient1Application {
  12.  
  13. @LoadBalanced
  14. @Bean
  15. public RestTemplate restTemplate() {
  16. return new RestTemplate();
  17. }
  18.  
  19. public static void main(String[] args) {
  20. SpringApplication.run(EurekaClient1Application.class, args);
  21. }
  22. }
  23.  
  24. @HystrixCollapser(batchMethod = "getAll")
  25. public Integer get(Integer index) {
  26. logger.info("invoke getOne !!!!!!!!!!!!");
  27. return restTemplate.getForObject("http://eureka-client-2/getOne/{1}",Integer.class,index);
  28. }
  29.  
  30. @HystrixCommand(fallbackMethod = "getAllError")
  31. public List<Integer> getAll(List<Integer> indices) {
  32. logger.info("invoke multi !!!!!!!!!!!!!!!");
  33. final String ids = indices.toString().replaceAll("\[|\]", "");
  34. return restTemplate.getForObject("http://eureka-client-2/getMulti?ids={1}", List.class, ids);
  35. }
  36.  
  37. private List<Integer> getAllError(List<Integer> indices) {
  38. return Collections.emptyList();
  39. }
  40.  
  41. public class HystrixLifecycleForwardingRequestVariable<T> extends HystrixRequestVariableDefault<T> {
  42. .....
  43.  
  44. @Override
  45. public T get() {
  46. if (!HystrixRequestContext.isCurrentThreadInitialized()) {
  47. return null;
  48. }
  49. return super.get();
  50. }
Add Comment
Please, Sign In to add comment