Merge branch 'sigar-1.6'

This commit is contained in:
Doug MacEachern 2011-04-08 10:49:37 -07:00
commit 436ceb351a
3 changed files with 20 additions and 3 deletions

View File

@ -508,6 +508,7 @@
<include name="bindings/java/**/*.java"/> <include name="bindings/java/**/*.java"/>
<include name="bindings/java/**/*.java.in"/> <include name="bindings/java/**/*.java.in"/>
<include name="bindings/java/**/*.c"/> <include name="bindings/java/**/*.c"/>
<include name="bindings/java/**/*.cpp"/>
<include name="bindings/java/**/*.h"/> <include name="bindings/java/**/*.h"/>
<include name="bindings/java/**/*.pl"/> <include name="bindings/java/**/*.pl"/>
<include name="bindings/java/**/build.xml"/> <include name="bindings/java/**/build.xml"/>

View File

@ -23,6 +23,8 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.apache.log4j.Logger;
public abstract class FileWatcher { public abstract class FileWatcher {
private Sigar sigar; private Sigar sigar;
@ -31,6 +33,9 @@ public abstract class FileWatcher {
private Set files = private Set files =
Collections.synchronizedSet(new HashSet()); Collections.synchronizedSet(new HashSet());
private static final Logger log =
SigarLog.getLogger(FileWatcher.class.getName());
public abstract void onChange(FileInfo info); public abstract void onChange(FileInfo info);
public void onNotFound(FileInfo info) { public void onNotFound(FileInfo info) {
@ -66,14 +71,22 @@ public abstract class FileWatcher {
public void add(File[] files) public void add(File[] files)
throws SigarException { throws SigarException {
for (int i=0; i<files.length; i++) { for (int i=0; i<files.length; i++) {
try {
add(files[i]); add(files[i]);
} catch (SigarFileNotFoundException e) {
log.error("Cannot add file: " + files[i].getAbsolutePath(), e);
}
} }
} }
public void add(String[] files) public void add(String[] files)
throws SigarException { throws SigarException {
for (int i=0; i<files.length; i++) { for (int i=0; i<files.length; i++) {
try {
add(files[i]); add(files[i]);
} catch (SigarFileNotFoundException e) {
log.error("Cannot add file: " + files[i], e);
}
} }
} }

View File

@ -19,6 +19,7 @@ package org.hyperic.sigar.test;
import java.util.Date; import java.util.Date;
import org.hyperic.sigar.SigarException; import org.hyperic.sigar.SigarException;
import org.hyperic.sigar.SigarLoader;
import org.hyperic.sigar.Who; import org.hyperic.sigar.Who;
public class TestWho extends SigarTestCase { public class TestWho extends SigarTestCase {
@ -39,7 +40,9 @@ public class TestWho extends SigarTestCase {
who[i].getDevice() + "\t" + who[i].getDevice() + "\t" +
new Date(who[i].getTime() * 1000) + "\t" + new Date(who[i].getTime() * 1000) + "\t" +
host); host);
if (!SigarLoader.IS_WIN32) {
assertLengthTrace("user", who[i].getUser()); assertLengthTrace("user", who[i].getUser());
} }
} }
} }
}