Search in sources :

Example 6 with ClusterInstanceInfo

use of com.sun.corba.ee.spi.folb.ClusterInstanceInfo in project Payara by payara.

the class RoundRobinPolicy method merge.

// Add those elements of the second list that do not contain a clear
// text address that appears in the first list.
private List<ClusterInstanceInfo> merge(List<ClusterInstanceInfo> first, List<ClusterInstanceInfo> second) {
    List<ClusterInstanceInfo> result = new ArrayList<ClusterInstanceInfo>();
    result.addAll(first);
    for (ClusterInstanceInfo info : second) {
        for (SocketInfo si : info.endpoints()) {
            if (!containsMatchingAddress(first, si.host(), si.port())) {
                result.add(info);
            }
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) SocketInfo(com.sun.corba.ee.spi.folb.SocketInfo) ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo)

Example 7 with ClusterInstanceInfo

use of com.sun.corba.ee.spi.folb.ClusterInstanceInfo in project Payara by payara.

the class IiopFolbGmsClient method addMember.

private void addMember(final String signal) {
    final String instanceName = signal;
    try {
        fineLog("IiopFolbGmsClient.addMember->: {0}", instanceName);
        synchronized (this) {
            if (currentMembers.get(instanceName) != null) {
                fineLog("IiopFolbGmsClient.addMember: {0} already present: no action", instanceName);
            } else {
                ClusterInstanceInfo clusterInstanceInfo = getClusterInstanceInfo(instanceName);
                currentMembers.put(clusterInstanceInfo.name(), clusterInstanceInfo);
                fineLog("IiopFolbGmsClient.addMember: {0} added - notifying listeners", instanceName);
                gis.notifyObservers();
                fineLog("IiopFolbGmsClient.addMember: {0} - notification complete", instanceName);
            }
        }
    } finally {
        fineLog("IiopFolbGmsClient.addMember<-: {0}", instanceName);
    }
}
Also used : ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo)

Example 8 with ClusterInstanceInfo

use of com.sun.corba.ee.spi.folb.ClusterInstanceInfo in project Payara by payara.

the class IiopFolbGmsClient method getClusterInstanceInfo.

private ClusterInstanceInfo getClusterInstanceInfo(Server server, Config config, boolean assumeInstanceIsRunning) {
    if (server == null) {
        return null;
    }
    if (!assumeInstanceIsRunning) {
        if (!server.isRunning()) {
            return null;
        }
    }
    fineLog("getClusterInstanceInfo: server {0}, config {1}", server, config);
    final String name = server.getName();
    fineLog("getClusterInstanceInfo: name {0}", name);
    final int weight = Integer.parseInt(server.getLbWeight());
    fineLog("getClusterInstanceInfo: weight {0}", weight);
    final IiopService iservice = config.getExtensionByType(IiopService.class);
    fineLog("getClusterInstanceInfo: iservice {0}", iservice);
    final String nodeName = server.getNodeRef();
    String hostName = nodeName;
    if (nodes != null) {
        Node node = nodes.getNode(nodeName);
        if (node != null) {
            // System level, use the local host name
            if ((node.isLocal() && !Boolean.getBoolean(USE_NODE_HOST_FOR_LOCAL_NODE_SYSTEM_PROPERTY)) && (node.isLocal() && !Boolean.parseBoolean(iservice.getOrb().getPropertyValue(USE_NODE_HOST_FOR_LOCAL_NODE_PROPERTY, "false")))) {
                try {
                    hostName = InetAddress.getLocalHost().getHostName();
                } catch (UnknownHostException exc) {
                    fineLog("getClusterInstanceInfo: caught exception for localhost lookup {0}", exc);
                }
            } else {
                hostName = node.getNodeHost();
            }
        }
    }
    fineLog("getClusterInstanceInfo: host {0}", hostName);
    final List<IiopListener> listeners = iservice.getIiopListener();
    fineLog("getClusterInstanceInfo: listeners {0}", listeners);
    final List<SocketInfo> sinfos = new ArrayList<SocketInfo>();
    for (IiopListener il : listeners) {
        SocketInfo sinfo = new SocketInfo(il.getId(), hostName, resolvePort(server, il));
        sinfos.add(sinfo);
    }
    fineLog("getClusterInstanceInfo: sinfos {0}", sinfos);
    final ClusterInstanceInfo result = new ClusterInstanceInfo(name, weight, sinfos);
    fineLog("getClusterInstanceInfo: result {0}", result);
    return result;
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) UnknownHostException(java.net.UnknownHostException) IiopService(org.glassfish.orb.admin.config.IiopService) Node(com.sun.enterprise.config.serverbeans.Node) SocketInfo(com.sun.corba.ee.spi.folb.SocketInfo) ArrayList(java.util.ArrayList) ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo)

Example 9 with ClusterInstanceInfo

use of com.sun.corba.ee.spi.folb.ClusterInstanceInfo in project Payara by payara.

the class IiopFolbGmsClient method setORB.

public void setORB(ORB orb) {
    try {
        orb.register_initial_reference(ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE, (org.omg.CORBA.Object) gis);
        fineLog(".initGIS: naming registration complete: {0}", gis);
        // Just for logging
        GroupInfoService gisRef = (GroupInfoService) orb.resolve_initial_references(ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE);
        List<ClusterInstanceInfo> lcii = gisRef.getClusterInstanceInfo(null);
        fineLog("Results from getClusterInstanceInfo:");
        if (lcii != null) {
            for (ClusterInstanceInfo cii : lcii) {
                fineLog(cii.toString());
            }
        }
    } catch (InvalidName e) {
        fineLog(".initGIS: registering GIS failed: {0}", e);
    }
}
Also used : InvalidName(org.omg.CORBA.ORBPackage.InvalidName) ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo) GroupInfoService(com.sun.corba.ee.spi.folb.GroupInfoService)

Example 10 with ClusterInstanceInfo

use of com.sun.corba.ee.spi.folb.ClusterInstanceInfo in project Payara by payara.

the class IiopFolbGmsClient method getAllClusterInstanceInfo.

private Map<String, ClusterInstanceInfo> getAllClusterInstanceInfo() {
    final Cluster myCluster = myServer.getCluster();
    fineLog("getAllClusterInstanceInfo: myCluster {0}", myCluster);
    final Config myConfig = getConfigForServer(myServer);
    fineLog("getAllClusterInstanceInfo: myConfig {0}", myConfig);
    final Map<String, ClusterInstanceInfo> result = new HashMap<String, ClusterInstanceInfo>();
    // null check is needed.
    if (myCluster != null) {
        for (Server server : myCluster.getInstances()) {
            ClusterInstanceInfo cii = getClusterInstanceInfo(server, myConfig, false);
            if (cii != null) {
                result.put(server.getName(), cii);
            }
        }
    }
    fineLog("getAllClusterInstanceInfo: result {0}", result);
    return result;
}
Also used : Server(com.sun.enterprise.config.serverbeans.Server) HashMap(java.util.HashMap) Config(com.sun.enterprise.config.serverbeans.Config) PayaraCluster(fish.payara.nucleus.cluster.PayaraCluster) Cluster(com.sun.enterprise.config.serverbeans.Cluster) ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo)

Aggregations

ClusterInstanceInfo (com.sun.corba.ee.spi.folb.ClusterInstanceInfo)13 ArrayList (java.util.ArrayList)6 SocketInfo (com.sun.corba.ee.spi.folb.SocketInfo)5 Config (com.sun.enterprise.config.serverbeans.Config)2 Server (com.sun.enterprise.config.serverbeans.Server)2 LinkedList (java.util.LinkedList)2 GroupInfoService (com.sun.corba.ee.spi.folb.GroupInfoService)1 SocketInfo (com.sun.corba.ee.spi.transport.SocketInfo)1 Cluster (com.sun.enterprise.config.serverbeans.Cluster)1 Node (com.sun.enterprise.config.serverbeans.Node)1 Servers (com.sun.enterprise.config.serverbeans.Servers)1 PayaraCluster (fish.payara.nucleus.cluster.PayaraCluster)1 UnknownHostException (java.net.UnknownHostException)1 HashMap (java.util.HashMap)1 IIOPSSLUtil (org.glassfish.enterprise.iiop.api.IIOPSSLUtil)1 IiopListener (org.glassfish.orb.admin.config.IiopListener)1 IiopService (org.glassfish.orb.admin.config.IiopService)1 InvalidName (org.omg.CORBA.ORBPackage.InvalidName)1 TaggedComponent (org.omg.IOP.TaggedComponent)1