use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientDynamicClusterConfig method invoke.
private void invoke(ClientMessage request) {
try {
ClientInvocation invocation = new ClientInvocation(instance, request, null);
ClientInvocationFuture future = invocation.invoke();
future.get();
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientDelegatingFutureTest method setup.
@Before
public void setup() {
serializationService = new DefaultSerializationServiceBuilder().build();
key = serializationService.toData("key");
value = serializationService.toData(DESERIALIZED_VALUE);
logger = mock(ILogger.class);
request = MapGetCodec.encodeRequest("test", key, 1L);
response = MapGetCodec.encodeResponse(value);
callIdSequence = mock(CallIdSequence.class);
invocationFuture = new ClientInvocationFuture(mock(ClientInvocation.class), request, logger, callIdSequence);
delegatingFuture = new ClientDelegatingFuture<>(invocationFuture, serializationService, MapGetCodec::decodeResponse, true);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class MCMessageTasksTest method assertFailure.
private void assertFailure(ClientMessage clientMessage, Class<? extends Exception> expectedExceptionType, String expectedExceptionMsg) throws Exception {
ClientInvocation invocation = new ClientInvocation(getClientImpl(), clientMessage, null);
ClientInvocationFuture future = invocation.invoke();
try {
future.get(ASSERT_TRUE_EVENTUALLY_TIMEOUT, SECONDS);
fail("Execution was successful whereas failure was expected.");
} catch (ExecutionException e) {
Throwable cause = e.getCause();
assertTrue("Cause is of type " + cause.getClass().toString(), cause.getClass().isAssignableFrom(expectedExceptionType));
assertEquals(expectedExceptionMsg, cause.getMessage());
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientMapProxy method submitToKeysInternal.
/**
* @param objectKeys not serialized key
* @param dataKeys serialized keys
*/
@Nonnull
protected <R> InternalCompletableFuture<Map<K, R>> submitToKeysInternal(@Nonnull Set<K> objectKeys, @Nonnull Collection<Data> dataKeys, @Nonnull EntryProcessor<K, V, R> entryProcessor) {
ClientMessage request = MapExecuteOnKeysCodec.encodeRequest(name, toData(entryProcessor), dataKeys);
ClientInvocationFuture future = new ClientInvocation(getClient(), request, getName()).invoke();
return new ClientDelegatingFuture<>(future, getSerializationService(), message -> prepareResult(MapExecuteOnKeysCodec.decodeResponse(message)));
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientMapProxy method removeAsyncInternal.
protected InternalCompletableFuture<V> removeAsyncInternal(Object key) {
try {
Data keyData = toData(key);
ClientMessage request = MapRemoveCodec.encodeRequest(name, keyData, getThreadId());
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService ss = getSerializationService();
return new ClientDelegatingFuture<>(future, ss, MapRemoveCodec::decodeResponse);
} catch (Exception e) {
throw rethrow(e);
}
}
Aggregations