use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class NearCachedClientMapProxy method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
ClientContext context = getContext();
logger = context.getLoggingService().getLogger(getClass());
NearCacheConfig nearCacheConfig = context.getClientConfig().getNearCacheConfig(name);
NearCacheManager nearCacheManager = context.getNearCacheManager();
IMapDataStructureAdapter<K, V> adapter = new IMapDataStructureAdapter<K, V>(this);
nearCache = nearCacheManager.getOrCreateNearCache(name, nearCacheConfig, adapter);
invalidateOnChange = nearCache.isInvalidatedOnChange();
if (invalidateOnChange) {
addNearCacheInvalidationListener(new ConnectedServerVersionAwareNearCacheEventHandler());
}
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class MapNearCacheBasicTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean loaderEnabled) {
IMapMapStore mapStore = loaderEnabled ? new IMapMapStore() : null;
Config config = createConfig(mapStore, false);
HazelcastInstance dataInstance = hazelcastFactory.newHazelcastInstance(config);
IMap<K, V> dataMap = dataInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
IMapDataStructureAdapter<K, V> dataAdapter = new IMapDataStructureAdapter<K, V>(dataMap);
// wait until the initial load is done
dataAdapter.waitUntilLoaded();
NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder(mapStore);
return builder.setDataInstance(dataInstance).setDataAdapter(dataAdapter).build();
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class LiteMemberMapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(IMapMapStore mapStore) {
Config configWithNearCache = getConfig(mapStore, true);
HazelcastInstance liteMember = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> liteMemberMap = liteMember.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(liteMember);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(liteMember)).setNearCacheInstance(liteMember).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(liteMemberMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setLoader(mapStore);
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class LiteMemberMapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
Config configWithNearCache = getConfig(true);
HazelcastInstance liteMember = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> liteMemberMap = liteMember.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(liteMember);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(liteMember)).setNearCacheInstance(liteMember).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(liteMemberMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class ClientMapNearCacheSerializationCountTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
Config config = getConfig().setProperty(MAP_INVALIDATION_MESSAGE_BATCH_SIZE.getName(), String.valueOf(Integer.MAX_VALUE)).setProperty(MAP_INVALIDATION_MESSAGE_BATCH_FREQUENCY_SECONDS.getName(), String.valueOf(Integer.MAX_VALUE)).setProperty(PARTITION_COUNT.getName(), "1").setProperty(PARTITION_OPERATION_THREAD_COUNT.getName(), "1");
config.getMapConfig(DEFAULT_NEAR_CACHE_NAME).setInMemoryFormat(mapInMemoryFormat).setBackupCount(0).setAsyncBackupCount(0);
prepareSerializationConfig(config.getSerializationConfig());
HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
IMap<K, V> memberMap = member.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheTestContextBuilder<K, V, Data, String> contextBuilder = createNearCacheContextBuilder();
return contextBuilder.setDataInstance(member).setDataAdapter(new IMapDataStructureAdapter<K, V>(memberMap)).build();
}
Aggregations