protected void ensureDeviceCacheHolder ( Integer deviceId , AllocationShape shape ) { if ( ! deviceCache . containsKey ( deviceId ) ) { try { synchronized ( this ) { if ( ! deviceCache . containsKey ( deviceId ) ) { deviceCache . put ( deviceId , new ConcurrentHashMap < AllocationShape , CacheHolder > ( ) ) ; } } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } if ( ! deviceCache . get ( deviceId ) . containsKey ( shape ) ) { try { singleLock . acquire ( ) ; if ( ! deviceCache . get ( deviceId ) . containsKey ( shape ) ) { deviceCache . get ( deviceId ) . put ( shape , new CacheHolder ( shape , deviceCachedAmount . get ( deviceId ) ) ) ; } } catch ( Exception e ) { } finally { singleLock . release ( ) ; } } }
This method checks if storage contains holder for specified shape