Пример #1
0
 /**
  * Set the value for the key. If the entry doesn't exist then it is inserted otherwise it's
  * updated.
  *
  * @param k
  * @param v
  */
 public void put(K k, V v) {
   WXSMapMBeanImpl mbean = WXSUtils.getWXSMapMBeanManager().getBean(grid.getName(), mapName);
   long start = System.nanoTime();
   try {
     InsertAgent<K, V> a = new InsertAgent<K, V>();
     a.doGet = true;
     a.batch = new TreeMap<K, V>();
     a.batch.put(k, v);
     a.isWriteThrough = true;
     Object o =
         tls.getMap(mapName).getAgentManager().callReduceAgent(a, Collections.singletonList(k));
     if (o instanceof Boolean) {
       Boolean b = (Boolean) o;
       if (!b) {
         logger.log(Level.SEVERE, "put(K,V) failed");
         throw new ObjectGridRuntimeException("put failed");
       }
     }
     mbean.getPutMetrics().logTime(System.nanoTime() - start);
   } catch (Exception e) {
     logger.log(Level.SEVERE, "Exception", e);
     mbean.getPutMetrics().logException(e);
     throw new ObjectGridRuntimeException(e);
   }
 }
Пример #2
0
 /**
  * Set the value for the key. If the entry doesn't exist then it is inserted otherwise it's
  * updated.
  *
  * @param k
  * @param v
  */
 public void put(K k, V v) {
   WXSMapMBeanImpl mbean = WXSUtils.getWXSMapMBeanManager().getBean(grid, mapName);
   long start = System.nanoTime();
   try {
     InsertAgent<K, V> a = new InsertAgent<K, V>();
     a.doGet = true;
     a.batch = new Hashtable<K, V>();
     a.batch.put(k, v);
     tls.getMap(mapName).getAgentManager().callReduceAgent(a, Collections.singletonList(k));
     mbean.getPutMetrics().logTime(System.nanoTime() - start);
   } catch (Exception e) {
     mbean.getPutMetrics().logException(e);
     throw new ObjectGridRuntimeException(e);
   }
 }
Пример #3
0
 public Map<K, Boolean> cond_putAll(Map<K, V> originalValues, Map<K, V> newValues) {
   WXSMapMBeanImpl mbean = WXSUtils.getWXSMapMBeanManager().getBean(grid.getName(), mapName);
   long start = System.nanoTime();
   Map<K, Boolean> rc = utils.cond_putAll(originalValues, newValues, bmap);
   mbean.getPutMetrics().logTime(System.nanoTime() - start);
   return rc;
 }
Пример #4
0
 /**
  * Parallel put all the entries.
  *
  * @param batch
  */
 public void putAll(Map<K, V> batch) {
   WXSMapMBeanImpl mbean = WXSUtils.getWXSMapMBeanManager().getBean(grid, mapName);
   long start = System.nanoTime();
   utils.putAll(batch, bmap);
   mbean.getPutMetrics().logTime(System.nanoTime() - start);
 }