use of com.hazelcast.client.connection.nio.ClientConnection in project hazelcast by hazelcast.
the class AbstractClientInternalCacheProxy method getConnectedServerVersion.
private int getConnectedServerVersion() {
ClientContext clientContext = getContext();
ClientClusterService clusterService = clientContext.getClusterService();
Address ownerConnectionAddress = clusterService.getOwnerConnectionAddress();
HazelcastClientInstanceImpl client = getClient();
ClientConnectionManager connectionManager = client.getConnectionManager();
Connection connection = connectionManager.getConnection(ownerConnectionAddress);
if (connection == null) {
logger.warning(format("No owner connection is available, " + "near cached cache %s will be started in legacy mode", name));
return UNKNOWN_HAZELCAST_VERSION;
}
return ((ClientConnection) connection).getConnectedServerVersion();
}
use of com.hazelcast.client.connection.nio.ClientConnection in project hazelcast by hazelcast.
the class ClientMapReduceProxy method invoke.
private ClientMessage invoke(ClientMessage request, String jobId) throws Exception {
ClientTrackableJob trackableJob = trackableJobs.get(jobId);
if (trackableJob != null) {
ClientConnection sendConnection = trackableJob.clientInvocation.getSendConnectionOrWait();
Address runningMember = sendConnection.getEndPoint();
final ClientInvocation clientInvocation = new ClientInvocation(getClient(), request, runningMember);
ClientInvocationFuture future = clientInvocation.invoke();
return future.get();
}
return null;
}
use of com.hazelcast.client.connection.nio.ClientConnection in project hazelcast by hazelcast.
the class ClientNonSmartInvocationServiceImpl method getConnection.
@Override
public ClientConnection getConnection(int partitionId) throws IOException {
ClientClusterService clusterService = client.getClientClusterService();
Address ownerConnectionAddress = clusterService.getOwnerConnectionAddress();
if (ownerConnectionAddress == null) {
throw new IOException("ClientNonSmartInvocationServiceImpl: Owner connection is not available.");
}
return (ClientConnection) connectionManager.getConnection(ownerConnectionAddress);
}
use of com.hazelcast.client.connection.nio.ClientConnection in project hazelcast by hazelcast.
the class ClientTransactionManagerServiceImpl method connect.
public ClientConnection connect() throws Exception {
Exception lastError = null;
int count = 0;
while (count < RETRY_COUNT) {
try {
final Address randomAddress = getRandomAddress();
return (ClientConnection) client.getConnectionManager().getOrConnect(randomAddress, false);
} catch (Exception e) {
lastError = e;
}
count++;
}
throw lastError;
}
use of com.hazelcast.client.connection.nio.ClientConnection in project hazelcast by hazelcast.
the class ClientClusterServiceImpl method getLocalClient.
@Override
public Client getLocalClient() {
Address address = getOwnerConnectionAddress();
final ClientConnectionManager cm = client.getConnectionManager();
final ClientConnection connection = (ClientConnection) cm.getConnection(address);
InetSocketAddress inetSocketAddress = connection != null ? connection.getLocalSocketAddress() : null;
final String uuid = getPrincipal().getUuid();
return new ClientImpl(uuid, inetSocketAddress);
}
Aggregations