Ejemplo n.º 1
0
        public virtual bool Remove(LocalizedResource rem, DeletionService delService)
        {
            // current synchronization guaranteed by crude RLS event for cleanup
            LocalizedResource rsrc = localrsrc[rem.GetRequest()];

            if (null == rsrc)
            {
                Log.Error("Attempt to remove absent resource: " + rem.GetRequest() + " from " + GetUser
                              ());
                return(true);
            }
            if (rsrc.GetRefCount() > 0 || ResourceState.Downloading.Equals(rsrc.GetState()) ||
                rsrc != rem)
            {
                // internal error
                Log.Error("Attempt to remove resource: " + rsrc + " with non-zero refcount");
                return(false);
            }
            else
            {
                // ResourceState is LOCALIZED or INIT
                if (ResourceState.Localized.Equals(rsrc.GetState()))
                {
                    delService.Delete(GetUser(), GetPathToDelete(rsrc.GetLocalPath()));
                }
                RemoveResource(rem.GetRequest());
                Log.Info("Removed " + rsrc.GetLocalPath() + " from localized cache");
                return(true);
            }
        }
Ejemplo 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());
 }