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;
}
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);
}
}
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;
}
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);
}
}
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;
}
Aggregations