From 73f0610abff6712b47ed7857657f997d5d9f7680 Mon Sep 17 00:00:00 2001 From: kshakir Date: Fri, 1 Apr 2011 20:26:26 +0000 Subject: [PATCH] When getCanonicalHostName fails use getHostName instead of getHostAddress as it's more compatible with our mail servers. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5553 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/queue/util/SystemUtils.scala | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala b/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala index 0bb4977b4..f2f5f3fa0 100644 --- a/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala +++ b/scala/src/org/broadinstitute/sting/queue/util/SystemUtils.scala @@ -34,23 +34,22 @@ import io.Source */ object SystemUtils { val inetAddress = InetAddress.getLocalHost.getHostAddress - val hostName = InetAddress.getLocalHost.getCanonicalHostName + val canonicalHostName = InetAddress.getLocalHost.getCanonicalHostName + + val hostName = { + if (canonicalHostName != inetAddress) + canonicalHostName + else + InetAddress.getLocalHost.getHostName + } val mailName = { val mailnameFile = new File("/etc/mailname") if (mailnameFile.exists) Source.fromFile(mailnameFile).mkString.trim - else if (hostName == inetAddress) - inetAddress else hostName.split('.').takeRight(2).mkString(".") } - val pidAtHost = { - val mxBeanName = ManagementFactory.getRuntimeMXBean.getName - if (hostName == inetAddress) - mxBeanName - else - mxBeanName.split('.').head - } + val pidAtHost = ManagementFactory.getRuntimeMXBean.getName.split('.').head }