Beispiel #1
0
        /// <exception cref="System.IO.IOException"/>
        public override void FinishResourceLocalization(string user, ApplicationId appId,
                                                        YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto proto)
        {
            string localPath    = proto.GetLocalPath();
            string startedKey   = GetResourceStartedKey(user, appId, localPath);
            string completedKey = GetResourceCompletedKey(user, appId, localPath);

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Storing localized resource to " + completedKey);
            }
            try
            {
                WriteBatch batch = db.CreateWriteBatch();
                try
                {
                    batch.Delete(JniDBFactory.Bytes(startedKey));
                    batch.Put(JniDBFactory.Bytes(completedKey), proto.ToByteArray());
                    db.Write(batch);
                }
                finally
                {
                    batch.Close();
                }
            }
            catch (DBException e)
            {
                throw new IOException(e);
            }
        }
Beispiel #2
0
 public override void FinishResourceLocalization(string user, ApplicationId appId,
                                                 YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto proto)
 {
     lock (this)
     {
         NMMemoryStateStoreService.TrackerState ts = GetTrackerState(new NMMemoryStateStoreService.TrackerKey
                                                                         (user, appId));
         Path localPath = new Path(proto.GetLocalPath());
         Sharpen.Collections.Remove(ts.inProgressMap, localPath);
         ts.localizedResources[localPath] = proto;
     }
 }