alex-plekhanov commented on a change in pull request #6554: IGNITE-11073: 
Backup page store manager, initial
URL: https://github.com/apache/ignite/pull/6554#discussion_r380078809
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
 ##########
 @@ -840,32 +787,35 @@ public void onCacheGroupsStopped(List<Integer> grps) {
      * @param parts Collection of pairs group and appropratate cache partition 
to be snapshotted.
      * @param snpSndr Factory which produces snapshot receiver instance.
      * @return Snapshot operation task which should be registered on 
checkpoint to run.
-     * @throws IgniteCheckedException If fails.
      */
-    SnapshotTask putSnapshotTask(
+    SnapshotFutureTask runSnapshotTask(
         String snpName,
         UUID srcNodeId,
         Map<Integer, GridIntList> parts,
-        Executor exec,
         SnapshotFileSender snpSndr
-    ) throws IgniteCheckedException {
+    ) {
         if (locSnpTasks.containsKey(snpName))
-            throw new IgniteCheckedException("Snapshot with requested name is 
already scheduled: " + snpName);
+            return new SnapshotFutureTask(new IgniteCheckedException("Snapshot 
with requested name is already scheduled: " + snpName));
+
+        SnapshotFutureTask snpFutTask;
 
-        SnapshotTask snpTask = locSnpTasks.computeIfAbsent(snpName,
-            snpName0 -> new SnapshotTask(cctx,
+        SnapshotFutureTask prev = locSnpTasks.putIfAbsent(snpName,
+            snpFutTask = new SnapshotFutureTask(cctx,
                 srcNodeId,
-                snpName0,
+                snpName,
                 tmpWorkDir,
-                exec,
                 ioFactory,
                 snpSndr,
                 parts));
 
-        snpTask.snapshotFuture()
-            .listen(f -> locSnpTasks.remove(snpName));
+        if (prev != null)
+            return new SnapshotFutureTask(new IgniteCheckedException("Snapshot 
with requested name is already scheduled: " + snpName));
 
-        return snpTask;
+        snpFutTask.listen(f -> locSnpTasks.remove(snpName));
+
+        snpFutTask.run();
 
 Review comment:
   I think there is no profit of using `Runnable` interface here. `run()` in 
`Runnable` mean execute completely. In your case it's more `start` or `init` 
than `run`. 
   Method `runSnapshotTask` also should be renamed accordingly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to