Search in sources :

Example 1 with TcpIpJoiner

use of com.hazelcast.internal.cluster.impl.TcpIpJoiner in project hazelcast by hazelcast.

the class JoinMastershipClaimOp method run.

@Override
public void run() {
    final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Node node = nodeEngine.getNode();
    Joiner joiner = node.getJoiner();
    ClusterServiceImpl clusterService = node.getClusterService();
    final ILogger logger = node.getLogger(getClass().getName());
    if (joiner instanceof TcpIpJoiner) {
        TcpIpJoiner tcpIpJoiner = (TcpIpJoiner) joiner;
        final Address endpoint = getCallerAddress();
        final Address masterAddress = clusterService.getMasterAddress();
        approvedAsMaster = !tcpIpJoiner.isClaimingMastership() && !clusterService.isMaster() && (masterAddress == null || masterAddress.equals(endpoint));
    } else {
        approvedAsMaster = false;
        logger.warning("This node requires MulticastJoin strategy!");
    }
    if (logger.isFineEnabled()) {
        logger.fine("Sending '" + approvedAsMaster + "' for master claim of node: " + getCallerAddress());
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Joiner(com.hazelcast.internal.cluster.Joiner) TcpIpJoiner(com.hazelcast.internal.cluster.impl.TcpIpJoiner) Address(com.hazelcast.cluster.Address) Node(com.hazelcast.instance.impl.Node) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ILogger(com.hazelcast.logging.ILogger) TcpIpJoiner(com.hazelcast.internal.cluster.impl.TcpIpJoiner)

Example 2 with TcpIpJoiner

use of com.hazelcast.internal.cluster.impl.TcpIpJoiner in project hazelcast by hazelcast.

the class Node method createJoiner.

Joiner createJoiner() {
    JoinConfig join = getActiveMemberNetworkConfig(config).getJoin();
    join.verify();
    if (shouldUseMulticastJoiner(join) && multicastService != null) {
        logger.info("Using Multicast discovery");
        return new MulticastJoiner(this);
    } else if (join.getTcpIpConfig().isEnabled()) {
        logger.info("Using TCP/IP discovery");
        return new TcpIpJoiner(this);
    } else if (properties.getBoolean(DISCOVERY_SPI_ENABLED) || isAnyAliasedConfigEnabled(join) || join.isAutoDetectionEnabled()) {
        logger.info("Using Discovery SPI");
        return new DiscoveryJoiner(this, discoveryService, usePublicAddress(join));
    }
    return null;
}
Also used : JoinConfig(com.hazelcast.config.JoinConfig) DiscoveryJoiner(com.hazelcast.internal.cluster.impl.DiscoveryJoiner) TcpIpJoiner(com.hazelcast.internal.cluster.impl.TcpIpJoiner) MulticastJoiner(com.hazelcast.internal.cluster.impl.MulticastJoiner)

Aggregations

TcpIpJoiner (com.hazelcast.internal.cluster.impl.TcpIpJoiner)2 Address (com.hazelcast.cluster.Address)1 JoinConfig (com.hazelcast.config.JoinConfig)1 Node (com.hazelcast.instance.impl.Node)1 Joiner (com.hazelcast.internal.cluster.Joiner)1 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)1 DiscoveryJoiner (com.hazelcast.internal.cluster.impl.DiscoveryJoiner)1 MulticastJoiner (com.hazelcast.internal.cluster.impl.MulticastJoiner)1 ILogger (com.hazelcast.logging.ILogger)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1