public GlobalMemory getMemory() {
        GlobalMemory ret;

        wLock.lock();
        try {

            if (!sysInfoCache.containsKey(PlatformResourceType.MEMORY)) {
                HashMap<String, GlobalMemory> cache = new HashMap<>(1);
                GlobalMemory mem = sysInfo.getHardware().getMemory();
                cache.put(PlatformResourceType.MEMORY.getResourceTypeId().getIDString(), mem);
                sysInfoCache.put(PlatformResourceType.MEMORY, cache);
            }
        } finally {
            // downgrade to a read-only lock since we just need it to read from the cache
            rLock.lock();
            try {
                wLock.unlock();
                ret = (GlobalMemory) sysInfoCache.get(PlatformResourceType.MEMORY)
                        .get(PlatformResourceType.MEMORY.getResourceTypeId().getIDString());
            } finally {
                rLock.unlock();
            }
        }

        return ret;
    }
public GlobalMemory getMemory ( ) { GlobalMemory ret ; wLock . lock ( ) ; try { if ( ! sysInfoCache . containsKey ( PlatformResourceType . MEMORY ) ) { HashMap < String , GlobalMemory > cache = new HashMap < > ( 1 ) ; GlobalMemory mem = sysInfo . getHardware ( ) . getMemory ( ) ; cache . put ( PlatformResourceType . MEMORY . getResourceTypeId ( ) . getIDString ( ) , mem ) ; sysInfoCache . put ( PlatformResourceType . MEMORY , cache ) ; } } finally { rLock . lock ( ) ; try { wLock . unlock ( ) ; ret = ( GlobalMemory ) sysInfoCache . get ( PlatformResourceType . MEMORY ) . get ( PlatformResourceType . MEMORY . getResourceTypeId ( ) . getIDString ( ) ) ; } finally { rLock . unlock ( ) ; } } return ret ; }
@return information about all the platform's memory