use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method entrySet.
@Override
public Set<Entry<K, V>> entrySet() {
ClientMessage request = MapEntrySetCodec.encodeRequest(name);
ClientMessage response = invoke(request);
MapEntrySetCodec.ResponseParameters resultParameters = MapEntrySetCodec.decodeResponse(response);
InflatableSet.Builder<Entry<K, V>> setBuilder = InflatableSet.newBuilder(resultParameters.response.size());
InternalSerializationService serializationService = ((InternalSerializationService) getContext().getSerializationService());
for (Entry<Data, Data> row : resultParameters.response) {
LazyMapEntry entry = new LazyMapEntry(row.getKey(), row.getValue(), serializationService);
setBuilder.add(entry);
}
return setBuilder.build();
}
use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method entrySet.
@Override
@SuppressWarnings("unchecked")
public Set<Entry<K, V>> entrySet(Predicate predicate) {
if (predicate instanceof PagingPredicate) {
return entrySetWithPagingPredicate((PagingPredicate) predicate);
}
ClientMessage request = MapEntriesWithPredicateCodec.encodeRequest(name, toData(predicate));
ClientMessage response = invoke(request);
MapEntriesWithPredicateCodec.ResponseParameters resultParameters = MapEntriesWithPredicateCodec.decodeResponse(response);
InflatableSet.Builder<Entry<K, V>> setBuilder = InflatableSet.newBuilder(resultParameters.response.size());
InternalSerializationService serializationService = ((InternalSerializationService) getContext().getSerializationService());
for (Entry<Data, Data> row : resultParameters.response) {
LazyMapEntry entry = new LazyMapEntry(row.getKey(), row.getValue(), serializationService);
setBuilder.add(entry);
}
return setBuilder.build();
}
use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.
the class ClientCacheRecordStateStressTest method assertFinalRecordStateIsReadPermitted.
private void assertFinalRecordStateIsReadPermitted(Cache clientCache, HazelcastInstance member) {
ClientCacheProxy proxy = ((ClientCacheProxy) clientCache);
NearCache nearCache = proxy.getNearCache();
DefaultNearCache unwrap = (DefaultNearCache) nearCache.unwrap(DefaultNearCache.class);
InternalSerializationService ss = getSerializationService(member);
for (int i = 0; i < KEY_SPACE; i++) {
Data key = ss.toData(i);
AbstractNearCacheRecordStore nearCacheRecordStore = (AbstractNearCacheRecordStore) unwrap.getNearCacheRecordStore();
NearCacheRecord record = nearCacheRecordStore.getRecord(key);
if (record != null) {
assertEquals(record.toString(), READ_PERMITTED, record.getRecordState());
}
}
}
use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.
the class DefaultClientExtension method createSerializationService.
@Override
public InternalSerializationService createSerializationService(byte version) {
InternalSerializationService ss;
try {
ClientConfig config = client.getClientConfig();
ClassLoader configClassLoader = config.getClassLoader();
HazelcastInstance hazelcastInstance = client;
PartitioningStrategy partitioningStrategy = getPartitioningStrategy(configClassLoader);
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
SerializationConfig serializationConfig = config.getSerializationConfig() != null ? config.getSerializationConfig() : new SerializationConfig();
if (version > 0) {
builder.setVersion(version);
}
ss = builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(new HazelcastClientManagedContext(client, config.getManagedContext())).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).build();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
return ss;
}
use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.
the class DefaultNodeExtension method createSerializationService.
public InternalSerializationService createSerializationService() {
InternalSerializationService ss;
try {
Config config = node.getConfig();
ClassLoader configClassLoader = node.getConfigClassLoader();
HazelcastInstanceImpl hazelcastInstance = node.hazelcastInstance;
PartitioningStrategy partitioningStrategy = getPartitioningStrategy(configClassLoader);
SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder();
SerializationConfig serializationConfig = config.getSerializationConfig() != null ? config.getSerializationConfig() : new SerializationConfig();
byte version = (byte) node.getProperties().getInteger(GroupProperty.SERIALIZATION_VERSION);
ss = (InternalSerializationService) builder.setClassLoader(configClassLoader).setConfig(serializationConfig).setManagedContext(hazelcastInstance.managedContext).setPartitioningStrategy(partitioningStrategy).setHazelcastInstance(hazelcastInstance).setVersion(version).build();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
return ss;
}
Aggregations