use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.
the class MapFlushMessageTask method call.
@Override
protected Object call() throws Exception {
MapService mapService = getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
ProxyService proxyService = nodeEngine.getProxyService();
DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters.name);
MapProxyImpl mapProxy = (MapProxyImpl) distributedObject;
mapProxy.flush();
return null;
}
use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.
the class MapLoadAllMessageTask method call.
@Override
protected Object call() {
final MapService mapService = getService(MapService.SERVICE_NAME);
final DistributedObject distributedObject = mapService.getMapServiceContext().getNodeEngine().getProxyService().getDistributedObject(MapService.SERVICE_NAME, parameters.name);
final MapProxyImpl mapProxy = (MapProxyImpl) distributedObject;
mapProxy.loadAll(parameters.replaceExistingValues);
return null;
}
use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.
the class MapRemoteService method createDistributedObject.
@Override
public DistributedObject createDistributedObject(String name) {
MapConfig mapConfig = nodeEngine.getConfig().findMapConfig(name);
checkMapConfig(mapConfig);
if (mapConfig.isNearCacheEnabled()) {
checkNearCacheConfig(name, mapConfig.getNearCacheConfig(), false);
return new NearCachedMapProxyImpl(name, mapServiceContext.getService(), nodeEngine, mapConfig);
} else {
return new MapProxyImpl(name, mapServiceContext.getService(), nodeEngine, mapConfig);
}
}
use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.
the class MapContainerCreationUponDestroyStressTest method getMapServiceContext.
private MapServiceContext getMapServiceContext(IMap map) {
MapProxyImpl mapProxy = (MapProxyImpl) map;
RemoteService service = mapProxy.getService();
MapService mapService = (MapService) service;
return mapService.getMapServiceContext();
}
use of com.hazelcast.map.impl.proxy.MapProxyImpl in project hazelcast by hazelcast.
the class EvictionMaxSizePolicyTest method setTestSizeEstimator.
public static void setTestSizeEstimator(IMap map, final long oneEntryHeapCostInBytes) {
final MapProxyImpl mapProxy = (MapProxyImpl) map;
final MapService mapService = (MapService) mapProxy.getService();
final MapServiceContext mapServiceContext = mapService.getMapServiceContext();
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final IPartitionService partitionService = nodeEngine.getPartitionService();
for (int i = 0; i < partitionService.getPartitionCount(); i++) {
final Address owner = partitionService.getPartitionOwner(i);
if (nodeEngine.getThisAddress().equals(owner)) {
final PartitionContainer container = mapServiceContext.getPartitionContainer(i);
if (container == null) {
continue;
}
final RecordStore recordStore = container.getRecordStore(map.getName());
final DefaultRecordStore defaultRecordStore = (DefaultRecordStore) recordStore;
defaultRecordStore.setSizeEstimator(new EntryCostEstimator() {
long size;
@Override
public long getEstimate() {
return size;
}
@Override
public void adjustEstimateBy(long size) {
this.size += size;
}
@Override
public long calculateValueCost(Object record) {
if (record == null) {
return 0L;
}
return oneEntryHeapCostInBytes;
}
@Override
public long calculateEntryCost(Object key, Object record) {
if (record == null) {
return 0L;
}
return 2 * oneEntryHeapCostInBytes;
}
@Override
public void reset() {
size = 0;
}
});
}
}
}
Aggregations