Skip to content

Commit 5e470b5

Browse files
authored
Merge pull request #1616 from dmgcodevil/iss1600
iss1600: Wrong hystrix event type for fallback missing
2 parents 1460419 + 0021399 commit 5e470b5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/AbstractHystrixCommand.java

-8
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,6 @@ Object process(Action action) throws Exception {
167167
@Override
168168
protected abstract T run() throws Exception;
169169

170-
/**
171-
* {@inheritDoc}.
172-
*/
173-
@Override
174-
protected T getFallback() {
175-
throw new RuntimeException("No fallback available.", getExecutionException());
176-
}
177-
178170
/**
179171
* Clears cache for the specified hystrix command.
180172
*/

hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/fallback/BasicCommandFallbackTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,24 @@ public void testCommandThrowsHystrixBadRequestExceptionWithNoCause() {
218218
}
219219
}
220220

221+
@Test
222+
public void testFallbackMissing(){
223+
try {
224+
userService.getUserWithoutFallback(null, null);
225+
} catch (Exception e) {}
226+
227+
HystrixInvokableInfo<?> command = getHystrixCommandByKey("getUserWithoutFallback");
228+
assertTrue("expected event: FALLBACK_MISSING", command.getExecutionEvents().contains(HystrixEventType.FALLBACK_MISSING));
229+
}
230+
221231
public static class UserService {
222232

233+
@HystrixCommand
234+
public User getUserWithoutFallback(final String id, final String name) {
235+
validate(id, name);
236+
return new User(id, name);
237+
}
238+
223239
@HystrixCommand(fallbackMethod = "fallback")
224240
public Future<User> getUserAsync(final String id, final String name) {
225241
validate(id, name); // validate logic can be inside and outside of AsyncResult#invoke method

0 commit comments

Comments
 (0)