@Test public void validDecrementCounterInCache() throws Throwable { Assume.assumeTrue(isValid); advice.decrementSingle(pjp); verify(cache).decr(cacheKey, 1); }
@AfterReturning("decrementSingleCounter()") public void decrementSingle(final JoinPoint jp) throws Throwable { if (isDisabled()) { getLogger().info("Cache disabled"); return; } String cacheKey = null; DecrementCounterInCache annotation; try { Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class); annotation = methodToCache.getAnnotation(DecrementCounterInCache.class); AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache); cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString()); getCacheBase().getCache(data).decr(cacheKey, 1); } catch (Exception ex) { warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString()); } }
DecrementCounterInCacheAdvice extends CounterInCacheBase { @AfterReturning("decrementSingleCounter()") public void decrementSingle(final JoinPoint jp) throws Throwable { if (isDisabled()) { getLogger().info("Cache disabled"); return; } String cacheKey = null; DecrementCounterInCache annotation; try { Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class); annotation = methodToCache.getAnnotation(DecrementCounterInCache.class); AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache); cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString()); getCacheBase().getCache(data).decr(cacheKey, 1); } catch (Exception ex) { warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString()); } } }
DecrementCounterInCacheAdvice extends CounterInCacheBase { @AfterReturning("decrementSingleCounter()") public void decrementSingle(final JoinPoint jp) throws Throwable { if (isDisabled()) { getLogger().info("Cache disabled"); return; } String cacheKey = null; DecrementCounterInCache annotation; try { Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class); annotation = methodToCache.getAnnotation(DecrementCounterInCache.class); AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache); cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString()); getCacheBase().getCache(data).decr(cacheKey, 1); } catch (Exception ex) { warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString()); } }  }
DecrementCounterInCacheAdvice extends CounterInCacheBase { @AfterReturning("decrementSingleCounter()") public void decrementSingle(final JoinPoint jp) throws Throwable { if (isDisabled()) { getLogger().info("Cache disabled"); return; } String cacheKey = null; DecrementCounterInCache annotation; try { Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class); annotation = methodToCache.getAnnotation(DecrementCounterInCache.class); AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache); cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString()); getCacheBase().getCache(data).decr(cacheKey, 1); } catch (Exception ex) { warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString()); } }  @Pointcut("@annotation(com.google.code.ssm.api.counter.DecrementCounterInCache)") void decrementSingleCounter(); @AfterReturning("decrementSingleCounter()") void decrementSingle(final JoinPoint jp); }
DecrementCounterInCacheAdvice extends CounterInCacheBase { @AfterReturning("decrementSingleCounter()") public void decrementSingle(final JoinPoint jp) throws Throwable { if (isDisabled()) { getLogger().info("Cache disabled"); return; } String cacheKey = null; DecrementCounterInCache annotation; try { Method methodToCache = getCacheBase().getMethodToCache(jp, DecrementCounterInCache.class); annotation = methodToCache.getAnnotation(DecrementCounterInCache.class); AnnotationData data = AnnotationDataBuilder.buildAnnotationData(annotation, DecrementCounterInCache.class, methodToCache); cacheKey = getCacheBase().getCacheKeyBuilder().getCacheKey(data, jp.getArgs(), methodToCache.toString()); getCacheBase().getCache(data).decr(cacheKey, 1); } catch (Exception ex) { warn(ex, "Decrementing counter [%s] via %s aborted due to an error.", cacheKey, jp.toShortString()); } }  @Pointcut("@annotation(com.google.code.ssm.api.counter.DecrementCounterInCache)") void decrementSingleCounter(); @AfterReturning("decrementSingleCounter()") void decrementSingle(final JoinPoint jp);  }