use of com.hazelcast.client.impl.proxy.ClientMapProxy in project hazelcast by hazelcast.
the class WriteMapP method init.
@Override
public void init(@Nonnull Outbox outbox, @Nonnull Context context) {
map = instance().getMap(mapName);
boolean hasCustomSerializers = serializationService instanceof DelegatingSerializationService && ((DelegatingSerializationService) serializationService).hasAddedSerializers();
boolean hasNearCache = map instanceof NearCachedMapProxyImpl;
if (hasNearCache && hasCustomSerializers) {
// See https://github.com/hazelcast/hazelcast-jet/issues/3046
throw new JetException("Writing into IMap with both near cache and custom serializers not supported");
}
if (!hasCustomSerializers) {
addToBuffer = item -> buffer.add(new SimpleEntry<>(key(item), value(item)));
} else if (map instanceof MapProxyImpl) {
PartitioningStrategy<?> partitionStrategy = ((MapProxyImpl<K, V>) map).getPartitionStrategy();
addToBuffer = item -> {
Data key = serializationService.toData(key(item), partitionStrategy);
Data value = serializationService.toData(value(item));
buffer.add(new SimpleEntry<>(key, value));
};
} else if (map instanceof ClientMapProxy) {
// TODO: add strategy/unify after https://github.com/hazelcast/hazelcast/issues/13950 is fixed
addToBuffer = item -> {
Data key = serializationService.toData(key(item));
Data value = serializationService.toData(value(item));
buffer.add(new SimpleEntry<>(key, value));
};
} else {
throw new RuntimeException("Unexpected map class: " + map.getClass().getName());
}
}
use of com.hazelcast.client.impl.proxy.ClientMapProxy in project hazelcast by hazelcast.
the class ClientQueryCacheRecoveryUponEventLossTest method setTestSequencer.
private void setTestSequencer(IMap map, int eventCount) {
ClientMapProxy proxy = (ClientMapProxy) map;
QueryCacheContext queryCacheContext = proxy.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
use of com.hazelcast.client.impl.proxy.ClientMapProxy in project hazelcast by hazelcast.
the class ClientQueryCacheContextTest method setUp.
@Before
public void setUp() {
factory = new TestHazelcastFactory();
factory.newHazelcastInstance();
HazelcastInstance hz = factory.newHazelcastClient();
ClientMapProxy proxy = (ClientMapProxy) hz.getMap("test");
context = proxy.getQueryCacheContext();
}
use of com.hazelcast.client.impl.proxy.ClientMapProxy in project hazelcast by hazelcast.
the class ClientQueryCacheEventLostListenerTest method setTestSequencer.
private void setTestSequencer(IMap map, int eventCount) {
ClientMapProxy proxy = (ClientMapProxy) map;
QueryCacheContext queryCacheContext = proxy.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
use of com.hazelcast.client.impl.proxy.ClientMapProxy in project hazelcast by hazelcast.
the class ClientQueryCacheMemoryLeakTest method removes_internal_query_caches_upon_map_destroy.
@Test
public void removes_internal_query_caches_upon_map_destroy() {
factory.newHazelcastInstance();
HazelcastInstance client = factory.newHazelcastClient();
String mapName = "test";
IMap<Integer, Integer> map = client.getMap(mapName);
populateMap(map);
for (int j = 0; j < 10; j++) {
map.getQueryCache(j + "-test-QC", Predicates.alwaysTrue(), true);
}
map.destroy();
ClientQueryCacheContext queryCacheContext = ((ClientMapProxy) map).getQueryCacheContext();
SubscriberContext subscriberContext = queryCacheContext.getSubscriberContext();
QueryCacheEndToEndProvider provider = subscriberContext.getEndToEndQueryCacheProvider();
QueryCacheFactory queryCacheFactory = subscriberContext.getQueryCacheFactory();
assertEquals(0, provider.getQueryCacheCount(mapName));
assertEquals(0, queryCacheFactory.getQueryCacheCount());
}
Aggregations