Search in sources :

Example 86 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientMapProxy method size.

@Override
public int size() {
    ClientMessage request = MapSizeCodec.encodeRequest(name);
    ClientMessage response = invoke(request);
    MapSizeCodec.ResponseParameters resultParameters = MapSizeCodec.decodeResponse(response);
    return resultParameters.response;
}
Also used : MapSizeCodec(com.hazelcast.client.impl.protocol.codec.MapSizeCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 87 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage 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 88 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientMapProxy method keySet.

@Override
@SuppressWarnings("unchecked")
public Set<K> keySet(Predicate predicate) {
    checkNotNull(predicate, NULL_PREDICATE_IS_NOT_ALLOWED);
    if (predicate instanceof PagingPredicate) {
        return keySetWithPagingPredicate((PagingPredicate) predicate);
    }
    ClientMessage request = MapKeySetWithPredicateCodec.encodeRequest(name, toData(predicate));
    ClientMessage response = invoke(request);
    MapKeySetWithPredicateCodec.ResponseParameters resultParameters = MapKeySetWithPredicateCodec.decodeResponse(response);
    InflatableSet.Builder<K> setBuilder = InflatableSet.newBuilder(resultParameters.response.size());
    for (Data data : resultParameters.response) {
        K key = toObject(data);
        setBuilder.add(key);
    }
    return setBuilder.build();
}
Also used : MapKeySetWithPredicateCodec(com.hazelcast.client.impl.protocol.codec.MapKeySetWithPredicateCodec) InflatableSet(com.hazelcast.util.collection.InflatableSet) PagingPredicate(com.hazelcast.query.PagingPredicate) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 89 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientMapProxy method evictInternal.

protected boolean evictInternal(Data keyData) {
    ClientMessage request = MapEvictCodec.encodeRequest(name, keyData, getThreadId());
    ClientMessage response = invoke(request, keyData);
    MapEvictCodec.ResponseParameters resultParameters = MapEvictCodec.decodeResponse(response);
    return resultParameters.response;
}
Also used : MapEvictCodec(com.hazelcast.client.impl.protocol.codec.MapEvictCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 90 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientMapProxy method putInternal.

protected V putInternal(long ttl, TimeUnit timeunit, Data keyData, Data valueData) {
    ClientMessage request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), getTimeInMillis(ttl, timeunit));
    ClientMessage response = invoke(request, keyData);
    MapPutCodec.ResponseParameters resultParameters = MapPutCodec.decodeResponse(response);
    return toObject(resultParameters.response);
}
Also used : MapPutCodec(com.hazelcast.client.impl.protocol.codec.MapPutCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Aggregations

ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)377 Data (com.hazelcast.nio.serialization.Data)140 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)47 ClientInvocationFuture (com.hazelcast.client.spi.impl.ClientInvocationFuture)37 SafeBuffer (com.hazelcast.client.impl.protocol.util.SafeBuffer)29 Address (com.hazelcast.nio.Address)25 QuickTest (com.hazelcast.test.annotation.QuickTest)24 Test (org.junit.Test)24 ClientDelegatingFuture (com.hazelcast.client.util.ClientDelegatingFuture)21 DataInputStream (java.io.DataInputStream)20 InputStream (java.io.InputStream)20 CacheEventData (com.hazelcast.cache.impl.CacheEventData)19 ParallelTest (com.hazelcast.test.annotation.ParallelTest)19 Member (com.hazelcast.core.Member)18 SerializationService (com.hazelcast.spi.serialization.SerializationService)18 ExecutionException (java.util.concurrent.ExecutionException)18 UnmodifiableLazyList (com.hazelcast.spi.impl.UnmodifiableLazyList)16 ArrayList (java.util.ArrayList)16 QueryCacheEventData (com.hazelcast.map.impl.querycache.event.QueryCacheEventData)13 CacheException (javax.cache.CacheException)13