diff --git a/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java b/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java index a88680c5217..7bcd2d81868 100644 --- a/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java +++ b/appserver/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java @@ -108,6 +108,11 @@ public class IiopFolbGmsClient implements CallBack { private Map currentMembers; private GroupInfoService gis; + + private static final String USE_NODE_HOST_FOR_LOCAL_NODE_PROPERTY = "useNodeHostForLocalNode"; + + private static final String USE_NODE_HOST_FOR_LOCAL_NODE_SYSTEM_PROPERTY = "fish.payara.iiop.gmsClient." + + USE_NODE_HOST_FOR_LOCAL_NODE_PROPERTY; private void fineLog( String fmt, Object... args ) { if(_logger.isLoggable(Level.FINE)) { @@ -352,12 +357,19 @@ private ClusterInstanceInfo getClusterInstanceInfo( Server server, 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) { - if (node.isLocal()) { + // If this is the local node, and the useNodeHostForLocalNode property has not been set at the ORB or + // 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) { @@ -372,9 +384,6 @@ private ClusterInstanceInfo getClusterInstanceInfo( Server server, fineLog( "getClusterInstanceInfo: host {0}", hostName ) ; - final IiopService iservice = config.getExtensionByType(IiopService.class) ; - fineLog( "getClusterInstanceInfo: iservice {0}", iservice ) ; - final List listeners = iservice.getIiopListener() ; fineLog( "getClusterInstanceInfo: listeners {0}", listeners ) ;