use SynchronizedSigar for getInstance
This commit is contained in:
parent
4898e1abe8
commit
c1429b68b8
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue