use SynchronizedSigar for getInstance

This commit is contained in:
Doug MacEachern 2004-06-21 23:16:02 +00:00
parent 4898e1abe8
commit c1429b68b8
1 changed files with 2 additions and 4 deletions

View File

@ -69,13 +69,11 @@ public class Sigar implements SigarProxy {
/** /**
* Convenience method to keep a sigar instance alive. * Convenience method to keep a sigar instance alive.
* This instance is not thread safe. * This instance is safe to share between threads.
*/ */
//XXX we could make it thread safe by returning a SigarProxy
//impl which synchronizes all method calls.
public static synchronized SigarProxy getInstance() { public static synchronized SigarProxy getInstance() {
if (instance == null) { if (instance == null) {
instance = new Sigar(); instance = new SynchronizedSigar();
} }
return instance; return instance;
} }