use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientRingbufferProxy method addAsync.
@Override
public InternalCompletableFuture<Long> addAsync(@Nonnull E item, @Nonnull OverflowPolicy overflowPolicy) {
checkNotNull(item, "item can't be null");
checkNotNull(overflowPolicy, "overflowPolicy can't be null");
Data element = toData(item);
ClientMessage request = RingbufferAddCodec.encodeRequest(name, overflowPolicy.getId(), element);
try {
ClientInvocationFuture future = new ClientInvocation(getClient(), request, getName(), partitionId).invoke();
return new ClientDelegatingFuture<>(future, getSerializationService(), RingbufferAddCodec::decodeResponse);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientTransactionUtil method invoke.
/**
* Handles the invocation exception for transactions so that users will not see internal exceptions.
* <p>
* More specifically IOException, because in case of a IO problem in ClientInvocation that send to a connection
* sends IOException to user. This wraps that exception into a TransactionException.
*/
public static ClientMessage invoke(ClientMessage request, Object objectName, HazelcastClientInstanceImpl client, Connection connection) {
try {
final ClientInvocation clientInvocation = new ClientInvocation(client, request, objectName, connection);
final Future<ClientMessage> future = clientInvocation.invoke();
return future.get();
} catch (Exception e) {
throw rethrow(e, TRANSACTION_EXCEPTION_WRAPPER);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class PartitionSpecificClientProxy method invokeOnPartitionInterruptibly.
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage, long invocationTimeoutSeconds) throws InterruptedException {
try {
ClientInvocation clientInvocation = new ClientInvocation(getClient(), clientMessage, getName(), partitionId);
clientInvocation.setInvocationTimeoutMillis(invocationTimeoutSeconds);
final Future future = clientInvocation.invoke();
return (T) future.get();
} catch (Exception e) {
throw ExceptionUtil.rethrowAllowInterrupted(e);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientProxySessionManager method requestNewSession.
@Override
protected SessionResponse requestNewSession(RaftGroupId groupId) {
ClientMessage request = CPSessionCreateSessionCodec.encodeRequest(groupId, client.getName());
ClientMessage response = new ClientInvocation(client, request, "sessionManager").invoke().joinInternal();
CPSessionCreateSessionCodec.ResponseParameters params = CPSessionCreateSessionCodec.decodeResponse(response);
return new SessionResponse(params.sessionId, params.ttlMillis, params.heartbeatMillis);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientProxySessionManager method generateThreadId.
@Override
protected long generateThreadId(RaftGroupId groupId) {
ClientMessage request = CPSessionGenerateThreadIdCodec.encodeRequest(groupId);
ClientMessage response = new ClientInvocation(client, request, "sessionManager").invoke().joinInternal();
return CPSessionGenerateThreadIdCodec.decodeResponse(response);
}
Aggregations