public Map<Object, Object> getAllMap(List<Object> keys) { try { final Map<Object, Object> entries = getRegion().getAll(keys); return (entries); } catch (IOException ex) { logger.info("error getting object ", ex); return null; } }
public Map<Object, Object> getAllMap(List<Object> keys) { try { final Map<Object, Object> entries = getRegion().getAll(keys); return (entries); } catch (IOException ex) { logger.info("error getting object ", ex); return null; } }
protected void checkWithGetAll(String uniqueName, ArrayList arrayl) { Region r1= getRootRegion(uniqueName + "-r1"); Region r2= getRootRegion(uniqueName + "-r2"); Map map1 = r1.getAll(arrayl); Map map2 = r2.getAll(arrayl); for (Object e : map1.keySet()) { String v = e.toString().replaceFirst("K", "V"); assertTrue( "Reading entries failed for key " + e + " where value = " + map1.get(e), v.equals(map1.get(e))); assertTrue( "Reading entries failed for key " + e + " where value = " + map2.get(e), v.equals(map2.get(e))); } }
/** * Gets all the values given the keys. Note that it does NOT work with hash * values or list values * * @param keys * @return All values for the given keys. */ @SuppressWarnings("unchecked") @Override public List<Object> getAll(List<Object> keys) { List<Object> values = new ArrayList<Object>(); try { final Map<Object, Object> entries = getRegion().getAll(keys); for (int i = 0; i < keys.size(); i++) { values.add(entries.get(keys.get(i))); } } catch (IOException ex) { logger.info("error getting region ", ex); } return (values); }
/** * Gets all the values given the keys. Note that it does NOT work with hash * values or list values * * @param keys * @return All values for the given keys. */ @SuppressWarnings("unchecked") @Override public List<Object> getAll(List<Object> keys) { List<Object> values = new ArrayList<Object>(); try { final Map<Object, Object> entries = getRegion().getAll(keys); for (int i = 0; i < keys.size(); i++) { values.add(entries.get(keys.get(i))); } } catch (IOException ex) { logger.info("error getting region ", ex); } return (values); }
public Map getAll(Collection keys) { try { preOp(); return this.realRegion.getAll(keys); } finally { postOp(); } }
@Override protected void checkWithGetAll(String uniqueName, ArrayList arrayl) { Region r = getRootRegion(uniqueName); Map map = r.getAll(arrayl); getCache().getLogger().info("Read entries " + map.size()); for (Object e : map.keySet()) { String v = e.toString().replaceFirst("K", "V"); assertTrue( "Reading entries failed for key " + e + " where value = " + map.get(e), v.equals(map.get(e))); } }
Map result = region.getAll(keys);
public Map getAll(Collection keys, Object callback) { try { preOp(); return this.realRegion.getAll(keys, callback); } finally { postOp(); } }
public void run() { Region region = getCache().getRegion("testSimplePdx"); try { ArrayList keys = new ArrayList(); for(int i =0; i < 1000; i++) { keys.add(i); } keys.add("test"); region.getAll(keys); fail("Should have received an exception"); } catch(SerializationException expected) { System.out.println("hi"); //ok } catch(ServerOperationException expected) { if(!(expected.getCause() instanceof SerializationException) && !(expected.getCause() instanceof ClassNotFoundException)) { throw expected; } } } };
public static void putAll() { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final List testKeysList = new ArrayList(); for (int i = (totalNumBuckets.intValue() * 3); i > 0; i--) { testKeysList.add("execKey-" + i); } DistributedSystem.setThreadsSocketPolicy(false); try { int j = 0; Map origVals = new HashMap(); for (Iterator i = testKeysList.iterator(); i.hasNext();) { Integer val = new Integer(j++); Object key = i.next(); origVals.put(key, val); region.put(key, val); } Map resultMap = region.getAll(testKeysList); assertTrue(resultMap.equals(origVals)); pause(2000); Map secondResultMap = region.getAll(testKeysList); assertTrue(secondResultMap.equals(origVals)); } catch (Exception e) { fail("Test failed after the put operation", e); } }
assertEquals(VALUE_3,new String(oldValue)); Map<String,byte[]> getAllMap = region.getAll(getAllCollection); oldValue = getAllMap.get(KEY_1); assertEquals(VALUE_1,new String(oldValue));
public static void getAll() { Region region = cache.getRegion(PartitionedRegionName); assertNotNull(region); final List testKeysList = new ArrayList(); for (int i = (totalNumBuckets.intValue() * 3); i > 0; i--) { testKeysList.add("execKey-" + i); } DistributedSystem.setThreadsSocketPolicy(false); try { int j = 0; Map origVals = new HashMap(); for (Iterator i = testKeysList.iterator(); i.hasNext();) { Integer val = new Integer(j++); Object key = i.next(); origVals.put(key, val); region.put(key, val); } Map resultMap = region.getAll(testKeysList); assertTrue(resultMap.equals(origVals)); pause(2000); Map secondResultMap = region.getAll(testKeysList); assertTrue(secondResultMap.equals(origVals)); }catch(Exception e){ fail("Test failed after the put operation", e); } }
private ByteBuffer processAsciiCommand(RequestReader request, Cache cache) { ByteBuffer buffer = request.getRequest(); CharBuffer flb = getFirstLineBuffer(); getAsciiDecoder().reset(); getAsciiDecoder().decode(buffer, flb, false); flb.flip(); String firstLine = getFirstLine(); String[] firstLineElements = firstLine.split(" "); boolean isGets = firstLineElements[0].equals("gets"); Set<String> keys = new HashSet<String>(); for (int i=1; i<firstLineElements.length; i++) { keys.add(stripNewline(firstLineElements[i])); } Region<Object, ValueWrapper> r = getMemcachedRegion(cache); Map<Object, ValueWrapper> results = r.getAll(keys); return composeReply(results, isGets); }
public Map<String, Configuration> getEntireConfiguration() throws Exception { Set<String> keys = getConfigurationRegion().keySet(); return getConfigurationRegion().getAll(keys); }
private ByteBuffer processAsciiCommand(RequestReader request, Cache cache) { ByteBuffer buffer = request.getRequest(); CharBuffer flb = getFirstLineBuffer(); getAsciiDecoder().reset(); getAsciiDecoder().decode(buffer, flb, false); flb.flip(); String firstLine = getFirstLine(); String[] firstLineElements = firstLine.split(" "); boolean isGets = firstLineElements[0].equals("gets"); Set<String> keys = new HashSet<String>(); for (int i=1; i<firstLineElements.length; i++) { keys.add(stripNewline(firstLineElements[i])); } Region<Object, ValueWrapper> r = getMemcachedRegion(cache); Map<Object, ValueWrapper> results = r.getAll(keys); return composeReply(results, isGets); }
assertEquals(VALUE_3,oldValue); Map<String,String> getAllMap = region.getAll(getAllCollection); assertTrue(getAllMap.containsValue(VALUE_1)); assertTrue(getAllMap.containsValue(VALUE_2));
private int getAll(int i, Region region, RegionName regionName) { List l = new ArrayList(); // add the first key l.add(ObjectHelper.createName(this.keyType, i)); // add the remaining keys for (int j = 1; j < UseCase3Prms.getBulkOpMapSize(); j++) { int k = getNextKey(); l.add(ObjectHelper.createName(this.keyType, k)); } // do the operation if (this.log.fineEnabled()) { this.log.fine("REGION=" + regionName + " OP=getAll KEYS=" + l); } int sz = l.size(); long start = this.statistics.startGetAll(regionName, sz); region.getAll(l); this.statistics.endGetAll(start, sz, regionName); return sz; }
public Operation getAll(Region r) { int beforeSize = r.size(); int numGetAllExistingKeys = TestConfig.tab().intAt(ParRegPrms.numPutAllExistingKeys); List keyList = new ArrayList(); int keyCount = 0; while (keyCount < numGetAllExistingKeys) { Object key = getRandomKey(r); if (key != null) { keyList.add(key); keyCount++; } if (beforeSize < numGetAllExistingKeys) { break; } } Log.getLogWriter().info("Doing a getAll with keys:"+keyList+" count is:"+keyList.size()); Map result = r.getAll(keyList); Log.getLogWriter().info("completed getAll: result size:"+result.size()); return new Operation(r.getFullPath(), keyList.toArray(), Operation.ENTRY_GETALL, null, null); } /** Does a getEntry in aRegion with a key existing in aRegion.
assertEquals(VALUE_3,oldValue); Map<String,Object> getAllMap = region.getAll(getAllCollection); assertTrue(getAllMap.containsValue(VALUE_1)); assertTrue(getAllMap.containsValue(VALUE_2));