use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MemberGroupFactoryTest method createMembers.
private Collection<Member> createMembers() throws UnknownHostException {
Collection<Member> members = new HashSet<Member>();
InetAddress fakeAddress = InetAddress.getLocalHost();
members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("192.192.0.1", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("192.168.3.101", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("192.168.3.101", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("172.16.5.11", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("172.16.5.11", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("172.123.0.13", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("172.123.0.13", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.com.tr", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.com.tr", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("jobs.hazelcast.com", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("jobs.hazelcast.com", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.org", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("www.hazelcast.org", fakeAddress, 5702), VERSION, false));
members.add(new MemberImpl(new Address("download.hazelcast.org", fakeAddress, 5701), VERSION, false));
members.add(new MemberImpl(new Address("download.hazelcast.org", fakeAddress, 5702), VERSION, false));
return members;
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class ScheduledTaskHandlerImplTest method of_addressConstructor.
@Test
public void of_addressConstructor() throws Exception {
Address addr = new Address("127.0.0.1", 0);
ScheduledTaskHandler handler = ScheduledTaskHandlerImpl.of(addr, "Scheduler", "Task");
String expectedURN = "urn:hzScheduledTaskHandler:127.0.0.1:0 -1 Scheduler Task";
assertTrue(handler.isAssignedToMember());
assertEquals(-1, handler.getPartitionId());
assertEquals(addr, handler.getAddress());
assertEquals("Scheduler", handler.getSchedulerName());
assertEquals("Task", handler.getTaskName());
assertEquals(expectedURN, handler.toUrn());
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class ScheduledTaskHandlerImplTest method of_withValidAddress.
@Test
public void of_withValidAddress() throws Exception {
Address addr = new Address("127.0.0.1", 0);
ScheduledTaskHandler handler = ScheduledTaskHandler.of("urn:hzScheduledTaskHandler:127.0.0.1:0 -1 Scheduler Task");
assertTrue(handler.isAssignedToMember());
assertEquals(-1, handler.getPartitionId());
assertEquals(addr, handler.getAddress());
assertEquals("Scheduler", handler.getSchedulerName());
assertEquals("Task", handler.getTaskName());
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MockConnectionManager method onClose.
public void onClose(final Connection connection) {
final Address endPoint = connection.getEndPoint();
if (mapConnections.remove(endPoint, connection)) {
logger.info("Removed connection to endpoint: " + endPoint + ", connection: " + connection);
ioService.getEventService().executeEventCallback(new StripedRunnable() {
@Override
public void run() {
for (ConnectionListener listener : connectionListeners) {
listener.connectionRemoved(connection);
}
}
@Override
public int getKey() {
return endPoint.hashCode();
}
});
}
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcher method scanMembers.
@Override
protected List<InternalCompletableFuture> scanMembers(List<String> names) {
Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
List<InternalCompletableFuture> futures = new ArrayList<InternalCompletableFuture>(members.size());
for (Member member : members) {
Address address = member.getAddress();
ClientMessage message = encodeRequest(names, address);
ClientInvocation invocation = new ClientInvocation(clientImpl, message, address);
try {
futures.add(invocation.invoke());
} catch (Exception e) {
if (logger.isWarningEnabled()) {
logger.warning("Cant fetch invalidation meta-data from address + " + address + " + [" + e.getMessage() + "]");
}
}
}
return futures;
}
Aggregations