Search in sources :

Example 11 with InternalSerializationService

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();
}
Also used : InflatableSet(com.hazelcast.util.collection.InflatableSet) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) MapEntrySetCodec(com.hazelcast.client.impl.protocol.codec.MapEntrySetCodec) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Example 12 with InternalSerializationService

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();
}
Also used : InflatableSet(com.hazelcast.util.collection.InflatableSet) PagingPredicate(com.hazelcast.query.PagingPredicate) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) MapEntriesWithPredicateCodec(com.hazelcast.client.impl.protocol.codec.MapEntriesWithPredicateCodec) LazyMapEntry(com.hazelcast.map.impl.LazyMapEntry) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Example 13 with InternalSerializationService

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());
        }
    }
}
Also used : ClientCacheProxy(com.hazelcast.client.cache.impl.ClientCacheProxy) DefaultNearCache(com.hazelcast.internal.nearcache.impl.DefaultNearCache) NearCacheRecord(com.hazelcast.internal.nearcache.NearCacheRecord) DefaultNearCache(com.hazelcast.internal.nearcache.impl.DefaultNearCache) NearCache(com.hazelcast.internal.nearcache.NearCache) Data(com.hazelcast.nio.serialization.Data) AbstractNearCacheRecordStore(com.hazelcast.internal.nearcache.impl.store.AbstractNearCacheRecordStore) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Example 14 with InternalSerializationService

use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.

the class PortableTest method testClassDefinitionLookupNativeOrderHeapData.

@Test
public void testClassDefinitionLookupNativeOrderHeapData() throws IOException {
    InternalSerializationService ss = new DefaultSerializationServiceBuilder().setUseNativeByteOrder(true).build();
    testClassDefinitionLookup(ss);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 15 with InternalSerializationService

use of com.hazelcast.internal.serialization.InternalSerializationService in project hazelcast by hazelcast.

the class PortableTest method testClassDefinitionLookupLittleEndianHeapData.

@Test
public void testClassDefinitionLookupLittleEndianHeapData() throws IOException {
    InternalSerializationService ss = new DefaultSerializationServiceBuilder().setByteOrder(ByteOrder.LITTLE_ENDIAN).build();
    testClassDefinitionLookup(ss);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)38 QuickTest (com.hazelcast.test.annotation.QuickTest)15 Test (org.junit.Test)15 Data (com.hazelcast.nio.serialization.Data)14 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)12 Map (java.util.Map)6 CachedQueryEntry (com.hazelcast.query.impl.CachedQueryEntry)5 IMap (com.hazelcast.core.IMap)4 QueryCacheRecord (com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord)4 SerializationService (com.hazelcast.spi.serialization.SerializationService)4 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)3 QueryEntry (com.hazelcast.query.impl.QueryEntry)3 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)3 SerializationConfig (com.hazelcast.config.SerializationConfig)2 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)2 TransactionalMap (com.hazelcast.core.TransactionalMap)2 NearCacheRecord (com.hazelcast.internal.nearcache.NearCacheRecord)2 DefaultNearCache (com.hazelcast.internal.nearcache.impl.DefaultNearCache)2 AbstractNearCacheRecordStore (com.hazelcast.internal.nearcache.impl.store.AbstractNearCacheRecordStore)2 SerializationServiceBuilder (com.hazelcast.internal.serialization.SerializationServiceBuilder)2