use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class SqlClientService method mappingDdl.
/**
* Gets a SQL Mapping suggestion for the given IMap name.
*
* Used by Management Center.
*/
@Nonnull
public CompletableFuture<String> mappingDdl(Member member, String mapName) {
checkNotNull(mapName);
ClientInvocation invocation = new ClientInvocation(client, SqlMappingDdlCodec.encodeRequest(mapName), null, member.getUuid());
return new ClientDelegatingFuture<>(invocation.invoke(), client.getSerializationService(), SqlMappingDdlCodec::decodeResponse);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientProtocolTest method testUnsupportedClientMessage.
@Test(expected = UnsupportedOperationException.class)
public void testUnsupportedClientMessage() {
hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client);
ClientMessage s = MapSizeCodec.encodeRequest("mapName");
int undefinedMessageType = -1;
s.setMessageType(undefinedMessageType);
ClientInvocation invocation = new ClientInvocation(clientImpl, s, "mapName");
try {
invocation.invoke().get();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class TcpClientConnectionManager method authenticateOnCluster.
private ClientAuthenticationCodec.ResponseParameters authenticateOnCluster(TcpClientConnection connection) {
Address memberAddress = connection.getInitAddress();
ClientMessage request = encodeAuthenticationRequest(memberAddress);
ClientInvocationFuture future = new ClientInvocation(client, request, null, connection).invokeUrgent();
try {
return ClientAuthenticationCodec.decodeResponse(future.get(authenticationTimeout, MILLISECONDS));
} catch (Exception e) {
connection.close("Failed to authenticate connection", e);
throw rethrow(e);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class HeartbeatManager method start.
public static void start(HazelcastClientInstanceImpl client, TaskScheduler taskScheduler, ILogger logger, long heartbeatIntervalMillis, long heartbeatTimeoutMillis, Collection<Connection> unmodifiableActiveConnections) {
taskScheduler.scheduleWithRepetition(() -> {
long now = Clock.currentTimeMillis();
for (Connection connection : unmodifiableActiveConnections) {
if (!connection.isAlive()) {
return;
}
if (now - connection.lastReadTimeMillis() > heartbeatTimeoutMillis) {
logger.warning("Heartbeat failed over the connection: " + connection);
connection.close("Heartbeat timed out", new TargetDisconnectedException("Heartbeat timed out to connection " + connection));
return;
}
if (now - connection.lastWriteTimeMillis() > heartbeatIntervalMillis) {
ClientMessage request = ClientPingCodec.encodeRequest();
ClientInvocation invocation = new ClientInvocation(client, request, null, connection);
invocation.invokeUrgent();
}
}
}, heartbeatIntervalMillis, heartbeatIntervalMillis, MILLISECONDS);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientSchemaService method get.
@Override
public Schema get(long schemaId) {
Schema schema = schemas.get(schemaId);
if (schema != null) {
return schema;
}
if (logger.isFinestEnabled()) {
logger.finest("Could not find schema id " + schemaId + " locally, will search on the cluster" + schemaId);
}
ClientInvocation invocation = new ClientInvocation(client, ClientFetchSchemaCodec.encodeRequest(schemaId), SERVICE_NAME);
ClientMessage message = invocation.invoke().joinInternal();
schema = ClientFetchSchemaCodec.decodeResponse(message);
if (schema != null) {
schemas.put(schemaId, schema);
}
return schema;
}
Aggregations