public virtual void AddResources(LocalResourcesTracker newTracker)
 {
     foreach (LocalizedResource resource in newTracker)
     {
         currentSize += resource.GetSize();
         if (resource.GetRefCount() > 0)
         {
             // always retain resources in use
             continue;
         }
         retain[resource] = newTracker;
     }
     for (IEnumerator <KeyValuePair <LocalizedResource, LocalResourcesTracker> > i = retain
                                                                                     .GetEnumerator(); currentSize - delSize > targetSize && i.HasNext();)
     {
         KeyValuePair <LocalizedResource, LocalResourcesTracker> rsrc = i.Next();
         LocalizedResource     resource_1 = rsrc.Key;
         LocalResourcesTracker tracker    = rsrc.Value;
         if (tracker.Remove(resource_1, delService))
         {
             delSize += resource_1.GetSize();
             i.Remove();
         }
     }
 }
Esempio n. 2
0
 private YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto BuildLocalizedResourceProto
     (LocalizedResource rsrc)
 {
     return((YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto)YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto
            .NewBuilder().SetResource(BuildLocalResourceProto(rsrc.GetRequest())).SetLocalPath
                (rsrc.GetLocalPath().ToString()).SetSize(rsrc.GetSize()).Build());
 }