Yes , this scenario is correct, and the problems is that in the servers when the threads is works the clear in the region are working , but the problems is wiith the clear in the other region in the other server.
I'll attach the xml file. The region is the "root-region".
And the code is the next:
private void snapshotCommonRegion(DeltaLoader loader, String regionName, Class<? extends BaseEntity> entityClass, Date toDate)
{
loader.addOperation(new UseRegionOperation(regionName));
Region<Object, Object> subRegion = getOrCreateSubRegion(regionName);
subRegion.clear();
for (BaseEntity domain : sourceRepository.findAllNotDeletedEntities(entityClass, toDate))
{
loader.addOperation(new PutOperation(domain));
subRegion.put(domain.getId(), domain);
}
}
private Region<Object, Object> getOrCreateSubRegion(String regionName)
{
Region<Object, Object> subRegion = rootRegion.getSubregion(regionName);
if (subRegion == null)
{
subRegion = rootRegion.createSubregion(regionName, rootRegion.getAttributes());
}
return subRegion;
}