1 package com.trendmicro.grid.acl.ds.cache.commands;
2
3 import org.aspectj.lang.ProceedingJoinPoint;
4
5 import java.util.Collection;
6 import java.util.Map;
7 import java.util.concurrent.atomic.AtomicLong;
8
9
10
11
12
13
14
15 public class GetFromPJPSourceCommand<K, V> extends GetFromSourceCommand<K, V> {
16
17 private final ProceedingJoinPoint proceedingJoinPoint;
18
19
20
21
22
23
24
25 public GetFromPJPSourceCommand(AtomicLong fetchedKeyCount, Collection<K> keys, ProceedingJoinPoint proceedingJoinPoint) {
26 super(fetchedKeyCount, keys);
27 this.proceedingJoinPoint = proceedingJoinPoint;
28 }
29
30 @Override
31 public Map<K, V> doCall() throws Exception {
32 try {
33 @SuppressWarnings("unchecked")
34 Collection<V> result = (Collection<V>) proceedingJoinPoint.proceed(new Object[]{keys});
35 return new MapAdapter<K, V>(keys, result);
36 } catch (Exception e) {
37 throw e;
38 } catch (Throwable throwable) {
39 throw new Exception(throwable);
40 }
41 }
42 }