Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Proper initialization of streams
  • Loading branch information
Matt Jacobs committed Jun 21, 2016
commit c0d6d6c85daf60ea9568e88665ba84a571dee1a7
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.netflix.hystrix.config.HystrixConfiguration;
import com.netflix.hystrix.config.HystrixConfigurationStream;
import com.netflix.hystrix.config.HystrixThreadPoolConfiguration;
import com.netflix.hystrix.metric.sample.HystrixUtilizationStream;
import rx.Observable;
import rx.functions.Func1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void onCompleted() {

@Override
public void onError(Throwable e) {
e.printStackTrace();
System.out.println(System.currentTimeMillis() + " : " + Thread.currentThread().getName() + " Config OnError : " + e);
latch.countDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ public class HystrixConfigurationStream {
private final Observable<HystrixConfiguration> allConfigurationStream;
private final AtomicBoolean isSourceCurrentlySubscribed = new AtomicBoolean(false);

private static final Func1<Long, HystrixConfiguration> getAllConfig =
new Func1<Long, HystrixConfiguration>() {
@Override
public HystrixConfiguration call(Long timestamp) {
return HystrixConfiguration.from(
getAllCommandConfig.call(timestamp),
getAllThreadPoolConfig.call(timestamp),
getAllCollapserConfig.call(timestamp)
);
}
};

/**
* @deprecated Not for public use. Please use {@link #getInstance()}. This facilitates better stream-sharing
* @param intervalInMilliseconds milliseconds between data emissions
Expand Down Expand Up @@ -159,17 +171,7 @@ public Map<HystrixCollapserKey, HystrixCollapserConfiguration> call(Long timesta
}
};

private static final Func1<Long, HystrixConfiguration> getAllConfig =
new Func1<Long, HystrixConfiguration>() {
@Override
public HystrixConfiguration call(Long timestamp) {
return HystrixConfiguration.from(
getAllCommandConfig.call(timestamp),
getAllThreadPoolConfig.call(timestamp),
getAllCollapserConfig.call(timestamp)
);
}
};


private static final Func1<HystrixConfiguration, Map<HystrixCommandKey, HystrixCommandConfiguration>> getOnlyCommandConfig =
new Func1<HystrixConfiguration, Map<HystrixCommandKey, HystrixCommandConfiguration>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ public class HystrixUtilizationStream {
private final Observable<HystrixUtilization> allUtilizationStream;
private final AtomicBoolean isSourceCurrentlySubscribed = new AtomicBoolean(false);

private static final Func1<Long, HystrixUtilization> getAllUtilization =
new Func1<Long, HystrixUtilization>() {
@Override
public HystrixUtilization call(Long timestamp) {
return HystrixUtilization.from(
getAllCommandUtilization.call(timestamp),
getAllThreadPoolUtilization.call(timestamp)
);
}
};

/**
* @deprecated Not for public use. Please use {@link #getInstance()}. This facilitates better stream-sharing
* @param intervalInMilliseconds milliseconds between data emissions
Expand Down Expand Up @@ -128,17 +139,6 @@ public Map<HystrixThreadPoolKey, HystrixThreadPoolUtilization> call(Long timesta
}
};

private static final Func1<Long, HystrixUtilization> getAllUtilization =
new Func1<Long, HystrixUtilization>() {
@Override
public HystrixUtilization call(Long timestamp) {
return HystrixUtilization.from(
getAllCommandUtilization.call(timestamp),
getAllThreadPoolUtilization.call(timestamp)
);
}
};

private static final Func1<HystrixUtilization, Map<HystrixCommandKey, HystrixCommandUtilization>> getOnlyCommandUtilization =
new Func1<HystrixUtilization, Map<HystrixCommandKey, HystrixCommandUtilization>>() {
@Override
Expand Down