package uk.ac.ebi.biosamples.model.util;

import java.util.concurrent.atomic.AtomicInteger;

public class ExecutionInfo {
    private AtomicInteger submitted;
    private AtomicInteger completed;
    private AtomicInteger error;

    public ExecutionInfo() {
        submitted = new AtomicInteger(0);
        completed = new AtomicInteger(0);
        error = new AtomicInteger(0);
    }


    public void incrementSubmitted(int value) {
        int oldValue = submitted.get();
        submitted.set(oldValue + value);
    }

    public void incrementCompleted(int value) {
        int oldValue = completed.get();
        completed.set(oldValue + value);
    }

    public void incrementError(int value) {
        int oldValue = error.get();
        error.set(oldValue + value);
    }

    public int getCompleted() {
        return completed.get();
    }

    public int getSubmitted() {
        return submitted.get();
    }

    public int getErrors() {
       return error.get();
    }
}

@@ -119,32 +119,38 @@
 o %7B%0A    private 
+final 
 AtomicInteger su
@@ -162,32 +162,38 @@
 ed;%0A    private 
+final 
 AtomicInteger co
@@ -213,16 +213,22 @@
 private 
+final 
 AtomicIn
@@ -460,73 +460,28 @@
     
-int oldValue = submitted.get();%0A        submitted.set(oldValue + 
+submitted.getAndAdd(
 valu
@@ -551,73 +551,28 @@
     
-int oldValue = completed.get();%0A        completed.set(oldValue + 
+completed.getAndAdd(
 valu
@@ -638,65 +638,24 @@
     
-int oldValue = error.get();%0A        error.set(oldValue + 
+error.getAndAdd(
 valu

Use atomic operation to increment the execution stats values