/** * Invokes the method. Also private method also can be invoked. * * @return result of execution */ @Override public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException { if(ExecutionType.ASYNCHRONOUS == executionType){ Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args); return executeClj(closure.getClosureObj(), closure.getClosureMethod()); } return execute(object, method, args); }
public HystrixGeneratedCacheKey generateCacheKey(CacheInvocationContext<? extends Annotation> cacheInvocationContext) throws HystrixCacheKeyGenerationException { MethodExecutionAction cacheKeyMethod = cacheInvocationContext.getCacheKeyMethod(); if (cacheKeyMethod != null) { try { return new DefaultHystrixGeneratedCacheKey((String) cacheKeyMethod.execute(cacheInvocationContext.getExecutionType())); } catch (Throwable throwable) { throw new HystrixCacheKeyGenerationException(throwable); } } else { if (cacheInvocationContext.hasKeyParameters()) { StringBuilder cacheKeyBuilder = new StringBuilder(); for (CacheInvocationParameter parameter : cacheInvocationContext.getKeyParameters()) { CacheKey cacheKey = parameter.getCacheKeyAnnotation(); if (cacheKey != null && StringUtils.isNotBlank(cacheKey.value())) { appendPropertyValue(cacheKeyBuilder, Arrays.asList(StringUtils.split(cacheKey.value(), ".")), parameter.getValue()); } else { cacheKeyBuilder.append(parameter.getValue()); } } return new DefaultHystrixGeneratedCacheKey(cacheKeyBuilder.toString()); } else { return DefaultHystrixGeneratedCacheKey.EMPTY; } } }
/** * Invokes the method. Also private method also can be invoked. * * @return result of execution */ @Override public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException { if(ExecutionType.ASYNCHRONOUS == executionType){ Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args); return executeClj(closure.getClosureObj(), closure.getClosureMethod()); } return execute(object, method, args); }
public HystrixGeneratedCacheKey generateCacheKey(CacheInvocationContext<? extends Annotation> cacheInvocationContext) throws HystrixCacheKeyGenerationException { MethodExecutionAction cacheKeyMethod = cacheInvocationContext.getCacheKeyMethod(); if (cacheKeyMethod != null) { try { return new DefaultHystrixGeneratedCacheKey((String) cacheKeyMethod.execute(cacheInvocationContext.getExecutionType())); } catch (Throwable throwable) { throw new HystrixCacheKeyGenerationException(throwable); } } else { if (cacheInvocationContext.hasKeyParameters()) { StringBuilder cacheKeyBuilder = new StringBuilder(); for (CacheInvocationParameter parameter : cacheInvocationContext.getKeyParameters()) { CacheKey cacheKey = parameter.getCacheKeyAnnotation(); if (cacheKey != null && StringUtils.isNotBlank(cacheKey.value())) { appendPropertyValue(cacheKeyBuilder, Arrays.asList(StringUtils.split(cacheKey.value(), ".")), parameter.getValue()); } else { cacheKeyBuilder.append(parameter.getValue()); } } return new DefaultHystrixGeneratedCacheKey(cacheKeyBuilder.toString()); } else { return DefaultHystrixGeneratedCacheKey.EMPTY; } } }