use of com.hazelcast.client.spi.ClientClusterService 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.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientSmartListenerService method start.
@Override
public void start() {
clientConnectionManager.addConnectionListener(this);
clientConnectionManager.addConnectionHeartbeatListener(this);
final ClientClusterService clientClusterService = client.getClientClusterService();
registrationExecutor.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
Collection<Member> memberList = clientClusterService.getMemberList();
for (Member member : memberList) {
clientConnectionManager.getOrTriggerConnect(member.getAddress(), false);
}
}
}, 1, 1, TimeUnit.SECONDS);
}
use of com.hazelcast.client.spi.ClientClusterService 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.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientPartitionServiceImpl method getOwnerConnection.
private Connection getOwnerConnection() {
ClientClusterService clusterService = client.getClientClusterService();
Address ownerAddress = clusterService.getOwnerConnectionAddress();
if (ownerAddress == null) {
return null;
}
Connection connection = client.getConnectionManager().getConnection(ownerAddress);
if (connection == null) {
return null;
}
return connection;
}
use of com.hazelcast.client.spi.ClientClusterService in project hazelcast by hazelcast.
the class ClientNonSmartInvocationServiceImpl method sendToOwner.
private void sendToOwner(ClientInvocation invocation) throws IOException {
ClientClusterService clusterService = client.getClientClusterService();
Address ownerConnectionAddress = clusterService.getOwnerConnectionAddress();
if (ownerConnectionAddress == null) {
throw new IOException("Packet is not send to owner address");
}
Connection conn = connectionManager.getConnection(ownerConnectionAddress);
if (conn == null) {
throw new IOException("Packet is not sent to owner address: " + ownerConnectionAddress);
}
send(invocation, (ClientConnection) conn);
}
Aggregations