Search in sources :

Example 1 with MulticastMemberInfo

use of com.hazelcast.spi.discovery.multicast.impl.MulticastMemberInfo in project hazelcast by hazelcast.

the class MulticastDiscoveryStrategy method discoverNodes.

@Override
public Iterable<DiscoveryNode> discoverNodes() {
    DiscoveryNode discoveryNode;
    MulticastMemberInfo multicastMemberInfo = multicastDiscoveryReceiver.receive();
    if (multicastMemberInfo == null) {
        return null;
    }
    ArrayList<DiscoveryNode> arrayList = new ArrayList<DiscoveryNode>();
    try {
        discoveryNode = new SimpleDiscoveryNode(new Address(multicastMemberInfo.getHost(), multicastMemberInfo.getPort()));
        arrayList.add(discoveryNode);
    } catch (UnknownHostException e) {
        logger.finest(e.getMessage());
    }
    return arrayList;
}
Also used : MulticastMemberInfo(com.hazelcast.spi.discovery.multicast.impl.MulticastMemberInfo) SimpleDiscoveryNode(com.hazelcast.spi.discovery.SimpleDiscoveryNode) DiscoveryNode(com.hazelcast.spi.discovery.DiscoveryNode) Address(com.hazelcast.cluster.Address) InetSocketAddress(java.net.InetSocketAddress) InetAddress(java.net.InetAddress) UnknownHostException(java.net.UnknownHostException) ArrayList(java.util.ArrayList) SimpleDiscoveryNode(com.hazelcast.spi.discovery.SimpleDiscoveryNode)

Aggregations

Address (com.hazelcast.cluster.Address)1 DiscoveryNode (com.hazelcast.spi.discovery.DiscoveryNode)1 SimpleDiscoveryNode (com.hazelcast.spi.discovery.SimpleDiscoveryNode)1 MulticastMemberInfo (com.hazelcast.spi.discovery.multicast.impl.MulticastMemberInfo)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1