extend FileSystem to ping nfs server

This commit is contained in:
Doug MacEachern 2005-02-21 02:03:17 +00:00
parent 760dac9604
commit f00916afee
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
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]));
}
}