本文整理了Java中org.apache.geode.cache.Region.putAll
方法的一些代码示例,展示了Region.putAll
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.putAll
方法的具体详情如下:
包路径:org.apache.geode.cache.Region
类名称:Region
方法名:putAll
[英]Copies all of the entries from the specified map to this region. The effect of this call is equivalent to that of calling #put(Object,Object) on this region once for each entry in the specified map. This operation will be distributed to other caches if the scope is not Scope.LOCAL
.
[中]将指定映射中的所有条目复制到此区域。此调用的效果相当于为指定映射中的每个条目在该区域上调用#put(Object,Object)一次。如果作用域不是[$0$],则此操作将分发到其他缓存。
代码示例来源:origin: apache/geode
@Override
public void putAll(Map t) {
map.putAll(t);
}
代码示例来源:origin: apache/geode
public void putAll(Map arg0) {
this.region.putAll(arg0);
}
代码示例来源:origin: apache/geode
/**
* uses putAll operation of region
*
* @param objectMap Object Map containing key-value operations
*/
public void putAllInLocalMonitoringRegion(Map<String, FederationComponent> objectMap) {
if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) {
localMonitoringRegion.putAll(objectMap);
}
}
代码示例来源:origin: apache/geode
public static void doPutAll(String regionName, int numPuts, int size) {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
assertNotNull(r);
for (long i = 0; i < numPuts; i++) {
Map putAllMap = new HashMap();
for (long j = 0; j < size; j++) {
putAllMap.put((size * i) + j, i);
}
r.putAll(putAllMap, "putAllCallback");
putAllMap.clear();
}
}
代码示例来源:origin: apache/geode
@Override
public void putAll(Map map, Object callbackArg) {
try {
preOp();
this.realRegion.putAll(map, callbackArg);
} finally {
postOp();
}
}
代码示例来源:origin: apache/geode
protected static void doPutAllP() throws Exception {
Region region = getCache().getRegion(REGION_NAME);
assertNotNull(region);
Map<String, Employee> map = new LinkedHashMap<>();
map.put("1010L", new Employee(1010L, "John", "Doe"));
region.putAll(map);
}
代码示例来源:origin: apache/geode
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 3 || commandElems.size() % 2 == 1) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HMSET));
return;
}
ByteArrayWrapper key = command.getKey();
Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion =
getOrCreateRegion(context, key, RedisDataType.REDIS_HASH);
Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
for (int i = 2; i < commandElems.size(); i += 2) {
byte[] fieldArray = commandElems.get(i);
ByteArrayWrapper field = new ByteArrayWrapper(fieldArray);
byte[] value = commandElems.get(i + 1);
map.put(field, new ByteArrayWrapper(value));
}
keyRegion.putAll(map);
command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
}
代码示例来源:origin: apache/geode
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
Region<ByteArrayWrapper, ByteArrayWrapper> r = context.getRegionProvider().getStringsRegion();
if (commandElems.size() < 3 || commandElems.size() % 2 == 0) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.MSET));
return;
}
Map<ByteArrayWrapper, ByteArrayWrapper> map = new HashMap<ByteArrayWrapper, ByteArrayWrapper>();
for (int i = 1; i < commandElems.size(); i += 2) {
byte[] keyArray = commandElems.get(i);
ByteArrayWrapper key = new ByteArrayWrapper(keyArray);
try {
checkAndSetDataType(key, context);
} catch (RedisDataTypeMismatchException e) {
continue;
}
byte[] value = commandElems.get(i + 1);
map.put(key, new ByteArrayWrapper(value));
}
r.putAll(map);
command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
}
代码示例来源:origin: apache/geode
clusterRegion.putAll(sharedConfiguration, memberId);
代码示例来源:origin: apache/geode
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 3) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SADD));
return;
}
ByteArrayWrapper key = command.getKey();
@SuppressWarnings("unchecked")
Region<ByteArrayWrapper, Boolean> keyRegion = (Region<ByteArrayWrapper, Boolean>) context
.getRegionProvider().getOrCreateRegion(key, RedisDataType.REDIS_SET, context);
if (commandElems.size() >= 4) {
Map<ByteArrayWrapper, Boolean> entries = new HashMap<ByteArrayWrapper, Boolean>();
for (int i = 2; i < commandElems.size(); i++)
entries.put(new ByteArrayWrapper(commandElems.get(i)), true);
keyRegion.putAll(entries);
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), entries.size()));
} else {
Object v = keyRegion.put(new ByteArrayWrapper(commandElems.get(2)), true);
command
.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), v == null ? 1 : 0));
}
}
代码示例来源:origin: apache/geode
r.putAll(map);
代码示例来源:origin: apache/geode
keyRegion.putAll(map);
} else {
byte[] scoreArray = commandElems.get(2);
代码示例来源:origin: spring-projects/spring-integration
@Override
public Object doInGemfire(Region region) throws GemFireCheckedException, GemFireException {
region.putAll(map);
return null;
}
代码示例来源:origin: apache/geode
newRegion = (Region<ByteArrayWrapper, Boolean>) rC.getOrCreateRegion(destination,
RedisDataType.REDIS_SET, context);
newRegion.putAll(map);
代码示例来源:origin: apache/geode
private void testAllOperations() {
ClientCache clientCache = (ClientCache) cache;
Region<String, String> region =
clientCache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create("internalRegion");
assertFailure(() -> region.create("Object1", "Value1"));
assertFailure(() -> region.put("Object1", "Value1"));
assertFailure(() -> region.putIfAbsent("Object1", "Value1"));
assertFailure(() -> region.get("Object1"));
Map<String, String> map = new HashMap<>();
map.put("Object1", "Value1");
assertFailure(() -> region.putAll(map));
List<String> list = new ArrayList<>();
list.add("Object1");
assertFailure(() -> region.getAll(list));
assertFailure(() -> region.removeAll(list));
assertFailure(() -> region.destroy("Object1"));
assertFailure(() -> region.remove("Object1"));
assertFailure(() -> region.replace("Object1", "oldValue", "newValue"));
assertFailure(() -> region.invalidate("Object1"));
assertFailure(region::keySetOnServer);
assertFailure(() -> region.registerInterest("Object1"));
}
代码示例来源:origin: apache/geode
map.put(keys[indices[i]], vals[indices[i]]);
region.putAll(map);
breakLoop = true;
代码示例来源:origin: apache/geode-examples
void insertValues(int upperLimit) {
Map values = new HashMap<Integer, String>();
IntStream.rangeClosed(1, upperLimit).forEach(i -> values.put(i, "value" + i));
region.putAll(values);
}
代码示例来源:origin: apache/geode-examples
void insertValues(Region<Integer, String> region, Collection<Integer> integers) {
Map values = new HashMap<Integer, String>();
for (Integer i : integers) {
values.put(i, i.toString());
}
region.putAll(values);
System.out.println(
ISO_8601_TIMESTAMP_FORMAT.format(new Date()) + "\tInserted " + values.size() + " values.");
}
代码示例来源:origin: org.springframework.data/spring-data-gemfire
@Override
public <K, V> void putAll(Map<? extends K, ? extends V> map) {
try {
this.<K, V>getRegion().putAll(map);
}
catch (GemFireException cause) {
throw convertGemFireAccessException(cause);
}
}
代码示例来源:origin: org.springframework.data/spring-data-geode
@Override
public <K, V> void putAll(Map<? extends K, ? extends V> map) {
try {
this.<K, V>getRegion().putAll(map);
}
catch (GemFireException cause) {
throw convertGemFireAccessException(cause);
}
}
内容来源于网络,如有侵权,请联系作者删除!