use of com.hazelcast.nio.Connection 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);
}
use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.
the class ClientSmartInvocationServiceImpl method getOrConnect.
private Connection getOrConnect(Address target) throws IOException {
ensureOwnerConnectionAvailable();
Connection connection = connectionManager.getOrConnect(target, false);
if (connection == null) {
throw new IOException("No available connection to address " + target);
}
return connection;
}
use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.
the class ClientSmartInvocationServiceImpl method invokeOnRandomTarget.
@Override
public void invokeOnRandomTarget(ClientInvocation invocation) throws IOException {
final Address randomAddress = getRandomAddress();
if (randomAddress == null) {
throw new IOException("Not address found to invoke ");
}
final Connection connection = getOrTriggerConnect(randomAddress);
send(invocation, (ClientConnection) connection);
}
use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.
the class ClientSmartInvocationServiceImpl method getOrTriggerConnect.
private Connection getOrTriggerConnect(Address target) throws IOException {
ensureOwnerConnectionAvailable();
Connection connection = connectionManager.getOrTriggerConnect(target, false);
if (connection == null) {
throw new IOException("No available connection to address " + target);
}
return connection;
}
use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.
the class ClientSmartInvocationServiceImpl method invokeOnTarget.
@Override
public void invokeOnTarget(ClientInvocation invocation, Address target) throws IOException {
if (target == null) {
throw new NullPointerException("Target can not be null");
}
if (!isMember(target)) {
throw new TargetNotMemberException("Target : " + target + " is not member. ");
}
final Connection connection = getOrTriggerConnect(target);
invokeOnConnection(invocation, (ClientConnection) connection);
}
Aggregations