use of com.sun.corba.ee.spi.folb.SocketInfo in project Payara by payara.
the class IiopFolbGmsClient method getIIOPEndpoints.
// return host:port,... string for all clear text ports in the cluster
// instance info.
public final String getIIOPEndpoints() {
final Map<String, ClusterInstanceInfo> cinfos = getAllClusterInstanceInfo();
final StringBuilder result = new StringBuilder();
boolean first = true;
for (ClusterInstanceInfo cinfo : cinfos.values()) {
for (SocketInfo sinfo : cinfo.endpoints()) {
if (!sinfo.type().startsWith("SSL")) {
if (first) {
first = false;
} else {
result.append(',');
}
result.append(sinfo.host()).append(':').append(sinfo.port());
}
}
}
return result.toString();
}
use of com.sun.corba.ee.spi.folb.SocketInfo in project Payara by payara.
the class RoundRobinPolicy method makeClusterInstanceInfo.
/**
* during bootstrapping, weight is assumed "10" for all endpoints
* then on, whenever server sends updates list,
* create the list again here with right weights
*/
private ClusterInstanceInfo makeClusterInstanceInfo(String str, int weight) {
// support IPV6 literal address
String[] host_port = new String[2];
int i = str.lastIndexOf(':');
host_port[0] = str.substring(0, i);
host_port[1] = str.substring(i + 1);
// for bootstrapping, can be ""
String server_identifier = "";
// will be clear_text for bootstrapping
String type = CLEAR_TEXT;
SocketInfo socketInfo = new SocketInfo(type, host_port[0], Integer.parseInt(host_port[1]));
List<SocketInfo> sil = new ArrayList<SocketInfo>(1);
sil.add(socketInfo);
return new ClusterInstanceInfo(server_identifier, weight, sil);
}
use of com.sun.corba.ee.spi.folb.SocketInfo 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.SocketInfo in project Payara by payara.
the class CSIV2TaggedComponentInfo method generateTransportAddresses.
private TransportAddress[] generateTransportAddresses(List<SocketInfo> socketInfos) {
TransportAddress[] transportAddresses = new TransportAddress[socketInfos.size()];
for (int i = 0; i < socketInfos.size(); i++) {
SocketInfo socketInfo = socketInfos.get(i);
transportAddresses[i] = new TransportAddress(socketInfo.host(), intToShort(socketInfo.port()));
}
return transportAddresses;
}
use of com.sun.corba.ee.spi.folb.SocketInfo 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;
}
Aggregations