private static String getHostNameImpl() { // Return bind address if available String bindAddr = System.getProperty("jboss.bind.address"); if (bindAddr != null && !bindAddr.trim().equals("0.0.0.0")) { return bindAddr; } // Fallback to qualified name String qualifiedHostName = System.getProperty("jboss.qualified.host.name"); if (qualifiedHostName != null) { return qualifiedHostName; } // If not on jboss env, let's try other possible fallbacks // POSIX-like OSes including Mac should have this set qualifiedHostName = System.getenv("HOSTNAME"); if (qualifiedHostName != null) { return qualifiedHostName; } // Certain versions of Windows qualifiedHostName = System.getenv("COMPUTERNAME"); if (qualifiedHostName != null) { return qualifiedHostName; } try { return NetworkUtils.canonize(getLocalHost().getHostName()); } catch (UnknownHostException uhe) { uhe.printStackTrace(); return "unknown-host.unknown-domain"; } }