コード例 #1
0
 public void RestoreWork()
 {
     Log.Info("restore thread running");
     while (!stopRequested)
     {
         RestoreJob job = restoreQueue.Dequeue();
         Log.Info("executing restore job " + job);
         job.Restore();
         // wait at least 2 seconds;
         Thread.Sleep(MILLIS_RESTORE_WAIT);
         restoreCompleted = restoreQueue.Size() == 0;
     }
     Log.Info("restore thread terminated");
 }
コード例 #2
0
            public bool RestoreGame(String game, String from)
            {
                BackupSet set = GetBackupSetForName(game);

                if (set != null)
                {
                    restoreCompleted = false;
                    restoredGame     = game;
                    RestoreJob job = new RestoreJob(set, from);
                    Log.Warning("restoring game " + game);
                    if (SAVE.configuration.asynchronous)
                    {
                        Log.Info("asynchronous restore from backup set '" + game + "' backup '" + from + "'");
                        restoreQueue.Enqueue(job);
                    }
                    else
                    {
                        Log.Info("synchronous restore from backup set '" + game + "' backup '" + from + "'");
                        // wait for asynchronous restores to complete
                        while (restoreQueue.Size() > 0)
                        {
                            Thread.Sleep(100);
                        }
                        // do restore
                        job.Restore();
                        // done
                        restoreCompleted = true;
                    }
                    return(true);
                }
                else
                {
                    Log.Warning("no backup set '" + game + "' found");
                    return(false);
                }
            }