Exemplo n.º 1
0
 public static <V> Task<V> get(String key, Class<V> valueType) {
   return Task.async(
       "Get PlanLocal",
       context -> {
         long id = context.getPlanId();
         final Map<String, Object> map = _planLocalMap.get(id);
         return Promises.value(map != null ? (V) map.get(key) : null);
       });
 }
Exemplo n.º 2
0
 public static <V> Task<Void> put(String key, V value) {
   return Task.async(
       "Put PlanLocal",
       context -> {
         long id = context.getPlanId();
         final Map<String, Object> map = _planLocalMap.computeIfAbsent(id, k -> new HashMap());
         map.put(key, value);
         return Promises.value(null);
       });
 }
Exemplo n.º 3
0
 public static Task<Void> remove(String key) {
   return Task.async(
       "Remove PlanLocal",
       context -> {
         long id = context.getPlanId();
         _planLocalMap.computeIfPresent(
             id,
             (k, v) -> {
               v.remove(key);
               return v.isEmpty() ? null : v;
             });
         return Promises.value(null);
       });
 }