diff --git a/bindings/java/src/net/hyperic/sigar/NfsFileSystem.java b/bindings/java/src/net/hyperic/sigar/NfsFileSystem.java index 0198d937..76ce418d 100644 --- a/bindings/java/src/net/hyperic/sigar/NfsFileSystem.java +++ b/bindings/java/src/net/hyperic/sigar/NfsFileSystem.java @@ -1,5 +1,8 @@ package net.hyperic.sigar; +import java.net.InetAddress; +import java.net.UnknownHostException; + public class NfsFileSystem extends FileSystem { private static native boolean ping(String hostname); @@ -11,7 +14,16 @@ public class NfsFileSystem extends FileSystem { String dev = getDevName(); int ix = dev.indexOf(":"); if (ix != -1) { - this.hostname = dev.substring(0, ix); + String host = dev.substring(0, ix); + InetAddress addr; + //try converting to ip in java land to take + //advantage of InetAddress' lookup cache. + try { + addr = InetAddress.getByName(host); + this.hostname = addr.getHostAddress(); + } catch (UnknownHostException e) { + this.hostname = host; + } } } return this.hostname;