Skip to content

Commit

Permalink
PAYARA-1767 (#1767)
Browse files Browse the repository at this point in the history
* PAYARA-1767 prospective fix

* PAYARA-1767 Add option to set it as a property of the ORB

* Correct logic
  • Loading branch information
Pandrex247 authored and smillidge committed Jul 17, 2017
1 parent 8b1762d commit f0f3c2c
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public class IiopFolbGmsClient implements CallBack {
private Map<String, ClusterInstanceInfo> 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)) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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<IiopListener> listeners = iservice.getIiopListener() ;
fineLog( "getClusterInstanceInfo: listeners {0}", listeners ) ;

Expand Down

0 comments on commit f0f3c2c

Please sign in to comment.