Search in sources :

Example 16 with ClientMessage

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

the class ClientReplicatedMapProxy method size.

@Override
public int size() {
    ClientMessage request = ReplicatedMapSizeCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request, targetPartitionId);
    ReplicatedMapSizeCodec.ResponseParameters result = ReplicatedMapSizeCodec.decodeResponse(response);
    return result.response;
}
Also used : ReplicatedMapSizeCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapSizeCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 17 with ClientMessage

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

the class ClientReplicatedMapProxy method addEntryListener.

@Override
public String addEntryListener(EntryListener<K, V> listener, Predicate<K, V> predicate, K key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    final Data keyData = toData(key);
    final Data predicateData = toData(predicate);
    EventHandler<ClientMessage> handler = createHandler(listener);
    return registerListener(createEntryListenerToKeyWithPredicateCodec(keyData, predicateData), handler);
}
Also used : Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 18 with ClientMessage

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

the class ClientReplicatedMapProxy method remove.

@Override
public V remove(Object key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    Data keyData = toData(key);
    ClientMessage request = ReplicatedMapRemoveCodec.encodeRequest(name, keyData);
    ClientMessage response = invoke(request, keyData);
    ReplicatedMapRemoveCodec.ResponseParameters result = ReplicatedMapRemoveCodec.decodeResponse(response);
    return toObject(result.response);
}
Also used : ReplicatedMapRemoveCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapRemoveCodec) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 19 with ClientMessage

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

the class ClientReplicatedMapProxy method containsKey.

@Override
public boolean containsKey(Object key) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    Data keyData = toData(key);
    ClientMessage request = ReplicatedMapContainsKeyCodec.encodeRequest(name, keyData);
    ClientMessage response = invoke(request, keyData);
    ReplicatedMapContainsKeyCodec.ResponseParameters result = ReplicatedMapContainsKeyCodec.decodeResponse(response);
    return result.response;
}
Also used : Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ReplicatedMapContainsKeyCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapContainsKeyCodec)

Example 20 with ClientMessage

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

the class ClientReplicatedMapProxy method keySet.

@Override
public Set<K> keySet() {
    ClientMessage request = ReplicatedMapKeySetCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request, targetPartitionId);
    ReplicatedMapKeySetCodec.ResponseParameters result = ReplicatedMapKeySetCodec.decodeResponse(response);
    List<Entry<K, V>> keys = new ArrayList<Entry<K, V>>(result.response.size());
    for (Data dataKey : result.response) {
        keys.add(new AbstractMap.SimpleImmutableEntry<K, V>((K) toObject(dataKey), null));
    }
    return new ResultSet(keys, IterationType.KEY);
}
Also used : AbstractMap(java.util.AbstractMap) ReplicatedMapKeySetCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapKeySetCodec) ArrayList(java.util.ArrayList) ResultSet(com.hazelcast.replicatedmap.impl.record.ResultSet) Data(com.hazelcast.nio.serialization.Data) 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