add static helper getNativeLibraryName
This commit is contained in:
		
							parent
							
								
									73b6f54d7e
								
							
						
					
					
						commit
						d98ddc9ac5
					
				@ -8,6 +8,7 @@ import net.hyperic.jni.ArchNotSupportedException;
 | 
			
		||||
public class SigarLoader extends ArchLoader {
 | 
			
		||||
 | 
			
		||||
    private static String location = null;
 | 
			
		||||
    private static String nativeName = null;
 | 
			
		||||
 | 
			
		||||
    public SigarLoader(Class loaderClass) {
 | 
			
		||||
        super(loaderClass);
 | 
			
		||||
@ -52,4 +53,21 @@ public class SigarLoader extends ArchLoader {
 | 
			
		||||
        }
 | 
			
		||||
        return location;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the name of the native sigar library.
 | 
			
		||||
     */
 | 
			
		||||
    public synchronized static String getNativeLibraryName() {
 | 
			
		||||
        if (nativeName == null) {
 | 
			
		||||
            SigarLoader loader = new SigarLoader(Sigar.class);
 | 
			
		||||
 | 
			
		||||
            try {
 | 
			
		||||
                nativeName = loader.getLibraryName();
 | 
			
		||||
            } catch (ArchNotSupportedException e) {
 | 
			
		||||
                nativeName = null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return nativeName;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user