use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class AbstractTargetMessageTask method processInternal.
@Override
protected CompletableFuture<Object> processInternal() {
Operation op = prepareOperation();
op.setCallerUuid(endpoint.getUuid());
MemberImpl member = nodeEngine.getClusterService().getMember(getTargetUuid());
if (member == null) {
throw new TargetNotMemberException(String.format("Member with uuid(%s) is not in member list ", getTargetUuid()));
}
return nodeEngine.getOperationService().createInvocationBuilder(getServiceName(), op, member.getAddress()).setResultDeserialized(false).invoke();
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class AbstractJetMessageTask method getInvocationBuilder.
@Override
protected InvocationBuilder getInvocationBuilder(Operation operation) {
Address address;
if (getLightJobCoordinator() != null) {
MemberImpl member = nodeEngine.getClusterService().getMember(getLightJobCoordinator());
if (member == null) {
throw new TopologyChangedException("Light job coordinator left the cluster");
}
address = member.getAddress();
} else {
address = nodeEngine.getMasterAddress();
if (address == null) {
throw new RetryableHazelcastException("master not yet known");
}
}
return nodeEngine.getOperationService().createInvocationBuilder(JetServiceBackend.SERVICE_NAME, operation, address);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class ScheduledFutureProxy method invokeOnTarget.
private <T> InvocationFuture<T> invokeOnTarget(Operation op, UUID uuid) {
NodeEngineImpl nodeEngine = ((HazelcastInstanceImpl) instance).node.getNodeEngine();
MemberImpl member = nodeEngine.getClusterService().getMember(uuid);
if (member == null) {
throw new IllegalStateException("Member with address: " + uuid + ", holding this scheduled task" + " is not part of this cluster.");
}
OperationService opService = nodeEngine.getOperationService();
return opService.invokeOnTarget(op.getServiceName(), op, member.getAddress());
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TcpClientConnectionManagerTranslateTest method testTranslateIsUsedWhenMemberHasPublicClientAddress.
@Test
public void testTranslateIsUsedWhenMemberHasPublicClientAddress() throws UnknownHostException {
// given
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(ClientProperty.DISCOVERY_SPI_PUBLIC_IP_ENABLED.getName(), "true");
HazelcastInstance client = HazelcastClientUtil.newHazelcastClient(null, clientConfig);
TcpClientConnectionManager clientConnectionManager = new TcpClientConnectionManager(getHazelcastClientInstanceImpl(client));
clientConnectionManager.start();
// private member address is unreachable
Member member = new MemberImpl(new Address("192.168.0.1", 5701), VERSION, false, UUID.randomUUID());
// public member address is reachable
member.getAddressMap().put(EndpointQualifier.resolve(ProtocolType.CLIENT, "public"), new Address("127.0.0.1", 5701));
// when
Connection connection = clientConnectionManager.getOrConnectToMember(member, false);
// then
assertNotNull(connection);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TcpClientConnectionManagerTranslateTest method testTranslateIsNotUsedWhenPublicIpDisabled.
@Test(expected = Exception.class)
public void testTranslateIsNotUsedWhenPublicIpDisabled() throws UnknownHostException {
// given
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(ClientProperty.DISCOVERY_SPI_PUBLIC_IP_ENABLED.getName(), "false");
HazelcastInstance client = HazelcastClientUtil.newHazelcastClient(null, clientConfig);
TcpClientConnectionManager clientConnectionManager = new TcpClientConnectionManager(getHazelcastClientInstanceImpl(client));
clientConnectionManager.start();
// private member address is incorrect
Member member = new MemberImpl(new Address("192.168.0.1", 5701), VERSION, false);
// public member address is correct
member.getAddressMap().put(EndpointQualifier.resolve(ProtocolType.CLIENT, "public"), new Address("127.0.0.1", 5701));
// when
clientConnectionManager.getOrConnectToMember(member, false);
// then
// throws exception because it can't connect to the incorrect member address
}
Aggregations