ResourceHandle newResourceHandle(K key,final Callable<? extends R> loader,EliminationStack<ResourceKey<K>> stack){
  try {
    final ResourceKey<K> resourceKey=timeToIdlePolicy.isPresent() ? new LinkedResourceKey<K>(stack,Status.IN_FLIGHT,key,timeToIdlePolicy.get().idleQueue) : new UnlinkedResourceKey<K>(stack,Status.IN_FLIGHT,key);
    R resource=loader.call();
    try {
      lifecycle.onCreate(resourceKey.getKey(),resource);
      cache.put(resourceKey,resource);
    }
 catch (    Exception e) {
      lifecycle.onRemoval(resourceKey.getKey(),resource);
      throw e;
    }
    ResourceHandle handle=new ResourceHandle(resourceKey,resource);
    resourceKey.handle=handle;
    return handle;
  }
 catch (  Exception e) {
    throw Throwables.propagate(e.getCause());
  }
}

ResourceHandle newResourceHandle ( K key , final Callable < ? extends R > loader , EliminationStack < ResourceKey < K > > stack ) { try { final ResourceKey < K > resourceKey = timeToIdlePolicy . isPresent ( ) ? new LinkedResourceKey < K > ( stack , Status . IN_FLIGHT , key , timeToIdlePolicy . get ( ) . idleQueue ) : new UnlinkedResourceKey < K > ( stack , Status . IN_FLIGHT , key ) ; R resource = loader . call ( ) ; try { lifecycle . onCreate ( resourceKey . getKey ( ) , resource ) ; cache . put ( resourceKey , resource ) ; } catch ( Exception e ) { lifecycle . onRemoval ( resourceKey . getKey ( ) , resource ) ; throw e ; } ResourceHandle handle = new ResourceHandle ( resourceKey , resource ) ; resourceKey . handle = handle ; return handle ; } catch ( Exception e ) { throw Throwables . propagate ( e . getCause ( ) ) ; } }
creates a new resource associated to the category key and stack .
