All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.infrautils.diagstatus.spi.NoClusterMemberInfo Maven / Gradle / Ivy

/*
 * Copyright (c) 2018 Red Hat, Inc. and others. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.infrautils.diagstatus.spi;

import com.google.common.net.InetAddresses;
import java.net.InetAddress;
import java.util.List;
import org.opendaylight.infrautils.diagstatus.ClusterMemberInfo;

/**
 * ClusterMemberInfo implementation when there is no cluster, suitable e.g. for tests.
 *
 * @author Michael Vorburger
 */
@Deprecated(forRemoval = true)
public class NoClusterMemberInfo implements ClusterMemberInfo {
    private final InetAddress selfInetAddress;

    public NoClusterMemberInfo() {
        this(InetAddresses.forString("127.0.0.1"));
    }

    public NoClusterMemberInfo(InetAddress selfInetAddress) {
        this.selfInetAddress = selfInetAddress;
    }

    @Override
    public InetAddress getSelfAddress() {
        return selfInetAddress;
    }

    @Override
    public List getClusterMembers() {
        return List.of();
    }

    @Override
    public boolean isLocalAddress(InetAddress isLocalIpAddress) {
        return selfInetAddress.equals(isLocalIpAddress);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy