package net.hyperic.sigar;

public class NfsFileSystem extends FileSystem {

    private static native boolean ping(String hostname);

    String hostname = null;

    public String getHostname() {
        if (this.hostname == null) {
            String dev = getDevName();
            int ix = dev.indexOf(":");
            if (ix != -1) {
                this.hostname = dev.substring(0, ix);
            }
        }
        return this.hostname;
    }

    public boolean ping() {
        return ping(getHostname());
    }

    public static void main(String[] args) throws Exception {
        Sigar.load();
        System.out.println(NfsFileSystem.ping(args[0]));
    }
}

@@ -21,16 +21,84 @@
 sigar;%0A%0A
+import java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0A%0A
 public c
@@ -418,29 +418,27 @@
         
-this.hostname
+String host
  = dev.s
@@ -454,16 +454,416 @@
 0, ix);%0A
+                InetAddress addr;%0A                //try converting to ip in java land to take%0A                //advantage of InetAddress' lookup cache.%0A                try %7B%0A                    addr = InetAddress.getByName(host);%0A                    this.hostname = addr.getHostAddress();%0A                %7D catch (UnknownHostException e) %7B%0A                    this.hostname = host;%0A                %7D%0A
         

use InetAddress lookup cache