Skip to content

Commit

Permalink
Merge pull request Netflix#1232 from mebigfatguy/master
Browse files Browse the repository at this point in the history
compare enums with ==, avoid chances of NPE
  • Loading branch information
mattrjacobs committed Jun 6, 2016
2 parents 6fc37dc + 01084cb commit ff552f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static void convertExecutionToJson(JsonGenerator json, HystrixRequestEve
json.writeArrayFieldStart("events");
ExecutionResult.EventCounts eventCounts = executionSignature.getEventCounts();
for (HystrixEventType eventType: HystrixEventType.values()) {
if (!eventType.equals(HystrixEventType.COLLAPSED)) {
if (eventType != HystrixEventType.COLLAPSED) {
if (eventCounts.contains(eventType)) {
int eventCount = eventCounts.getCount(eventType);
if (eventCount > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public void call(Notification<? super R> rNotification) {
}

private Observable<R> executeCommandWithSpecifiedIsolation(final AbstractCommand<R> _cmd) {
if (properties.executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.THREAD)) {
if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.THREAD) {
// mark that we are executing in a thread (even if we end up being rejected we still were a THREAD execution and not SEMAPHORE)
return Observable.defer(new Func0<Observable<R>>() {
@Override
Expand Down Expand Up @@ -674,7 +674,7 @@ public void call() {
}).subscribeOn(threadPool.getScheduler(new Func0<Boolean>() {
@Override
public Boolean call() {
return properties.executionIsolationThreadInterruptOnTimeout().get() && _cmd.isCommandTimedOut.get().equals(TimedOutStatus.TIMED_OUT);
return properties.executionIsolationThreadInterruptOnTimeout().get() && _cmd.isCommandTimedOut.get() == TimedOutStatus.TIMED_OUT;
}
}));
} else {
Expand Down Expand Up @@ -1209,7 +1209,7 @@ protected TryableSemaphore getFallbackSemaphore() {
* @return TryableSemaphore
*/
protected TryableSemaphore getExecutionSemaphore() {
if (properties.executionIsolationStrategy().get().equals(ExecutionIsolationStrategy.SEMAPHORE)) {
if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.SEMAPHORE) {
if (executionSemaphoreOverride == null) {
TryableSemaphore _s = executionSemaphorePerCircuit.get(commandKey.name());
if (_s == null) {
Expand Down Expand Up @@ -1719,7 +1719,7 @@ public boolean isCircuitBreakerOpen() {
* @return boolean
*/
public boolean isExecutionComplete() {
return commandState.get().equals(CommandState.TERMINAL);
return commandState.get() == CommandState.TERMINAL;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public boolean isExecutionStart() {

@Override
public boolean isExecutedInThread() {
return isolationStrategy.equals(HystrixCommandProperties.ExecutionIsolationStrategy.THREAD);
return isolationStrategy == HystrixCommandProperties.ExecutionIsolationStrategy.THREAD;
}

@Override
Expand Down

0 comments on commit ff552f9

Please sign in to comment.