Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor local variable 'caching' fixups #1238

Merged
merged 1 commit into from
Jun 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
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