Skip to content

Commit

Permalink
Merge pull request Netflix#1238 from mebigfatguy/master
Browse files Browse the repository at this point in the history
minor local variable 'caching' fixups
  • Loading branch information
mattrjacobs authored Jun 12, 2016
2 parents d3cd11c + fbf366d commit eb7c24a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class CacheInvocationContextFactory {
* @return initialized and configured {@link CacheInvocationContext}
*/
public static CacheInvocationContext<CacheResult> createCacheResultInvocationContext(MetaHolder metaHolder) {
if (metaHolder.getMethod().isAnnotationPresent(CacheResult.class)) {
Method method = metaHolder.getMethod();
Method method = metaHolder.getMethod();
if (method.isAnnotationPresent(CacheResult.class)) {
CacheResult cacheResult = method.getAnnotation(CacheResult.class);
MethodExecutionAction cacheKeyMethod = createCacheKeyAction(cacheResult.cacheKeyMethod(), metaHolder);
return new CacheInvocationContext<CacheResult>(cacheResult, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs());
Expand All @@ -56,8 +56,8 @@ public static CacheInvocationContext<CacheResult> createCacheResultInvocationCon
* @return initialized and configured {@link CacheInvocationContext}
*/
public static CacheInvocationContext<CacheRemove> createCacheRemoveInvocationContext(MetaHolder metaHolder) {
if (metaHolder.getMethod().isAnnotationPresent(CacheRemove.class)) {
Method method = metaHolder.getMethod();
Method method = metaHolder.getMethod();
if (method.isAnnotationPresent(CacheRemove.class)) {
CacheRemove cacheRemove = method.getAnnotation(CacheRemove.class);
MethodExecutionAction cacheKeyMethod = createCacheKeyAction(cacheRemove.cacheKeyMethod(), metaHolder);
return new CacheInvocationContext<CacheRemove>(cacheRemove, cacheKeyMethod, metaHolder.getObj(), method, metaHolder.getArgs());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ Object execute() {
*/
@Override
protected Object getFallback() {
if (getFallbackAction() != null) {
final CommandAction commandAction = getFallbackAction();
final CommandAction commandAction = getFallbackAction();
if (commandAction != null) {
try {
return process(new Action() {
@Override
Object execute() {
MetaHolder metaHolder = commandAction.getMetaHolder();
Object[] args = createArgsForFallback(metaHolder, getExecutionException());
return commandAction.executeWithArgs(commandAction.getMetaHolder().getFallbackExecutionType(), args);
return commandAction.executeWithArgs(metaHolder.getFallbackExecutionType(), args);
}
});
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ public Map<ExecutionSignature, List<Integer>> getExecutionsMappedToLatencies() {
Map<ExecutionSignature, List<Integer>> commandDeduper = new HashMap<ExecutionSignature, List<Integer>>();
for (HystrixInvokableInfo<?> execution: nonCachedExecutions) {
int cachedCount = 0;
String cacheKey = null;
if (execution.getPublicCacheKey() != null) {
cacheKey = execution.getPublicCacheKey();
String cacheKey = execution.getPublicCacheKey();
if (cacheKey != null) {
CommandAndCacheKey key = new CommandAndCacheKey(execution.getCommandKey().name(), cacheKey);
cachedCount = cachingDetector.get(key);
}
Expand Down

0 comments on commit eb7c24a

Please sign in to comment.