@Nullable SigarProxy getSigar() { if (this.sigar == null) { if (SigarAccess.isSigarAvailable()) { this.sigar = SigarAccess.getSigar(); } } return this.sigar; }
/** * Provides the caller with direct access to the Sigar native API via a proxy to Sigar. * This provides the caller with low-level access to platform functionality. * If the Sigar native layer is not available on the platform we are running on, or if * it has been disabled by the user, an exception will be thrown. * * @return the proxy used to access the native layer * * @throws SystemInfoException if native layer is unavailable or has been disabled */ public synchronized static SigarProxy getSigar() { if (isSigarAvailable()) { if (sigarProxy == null) { invocationHandler = new SigarAccessHandler(); sigarProxy = (SigarProxy) Proxy.newProxyInstance(SigarAccess.class.getClassLoader(), new Class[] { SigarProxy.class }, invocationHandler); } return sigarProxy; } else { throw new SystemInfoException("Native layer is not available or has been disabled"); } }
/** * Provides the caller with direct access to the Sigar native API via a proxy to Sigar. * This provides the caller with low-level access to platform functionality. * If the Sigar native layer is not available on the platform we are running on, or if * it has been disabled by the user, an exception will be thrown. * * @return the proxy used to access the native layer * * @throws SystemInfoException if native layer is unavailable or has been disabled */ public synchronized static SigarProxy getSigar() { if (isSigarAvailable()) { if (sigarProxy == null) { invocationHandler = new SigarAccessHandler(); sigarProxy = (SigarProxy) Proxy.newProxyInstance(SigarAccess.class.getClassLoader(), new Class[] { SigarProxy.class }, invocationHandler); } return sigarProxy; } else { throw new SystemInfoException("Native layer is not available or has been disabled"); } }