/** * Executes a series of tasks that are "locked" such that only one thread should execute each. * These are locked across multiple compute nodes as well. * * @param description Name of the series of tasks that will be executed * @param lockedCallables Tasks that will be executed * @throws Exception */ public static void ExecuteLockTasks(String description, ArrayList<LockedCallable> lockedCallables) throws Exception { MultiThreadedTaskHandler taskHandler = new MultiThreadedTaskHandler(description); // Prepare the tasks to be executed for (LockedCallable callable : lockedCallables) { FileUtilities.CreateFileDirectoryIfNotExists(callable.StatusFilePath); taskHandler.Add(callable); } try { // See if any of the tasks returned a false value and if so, pause then retry if (ListUtilities.AnyFalse(ListUtilities.CreateBooleanList(taskHandler.Execute()))) { Pause(description); ExecuteLockTasks(description, lockedCallables); } } catch (Exception ex) { // If an exception occurred, log it, pause, then try again Singletons.Log.Exception(ex); Pause(description); ExecuteLockTasks(description, lockedCallables); } }