Status updates code design I need help identifying any significant design issues with some code I have generated to track status updates.

I have a big task A which contains multiple small tasks and each of these small tasks updates the status of A in the data store.

This is how I've implemented:
For each type of Task A(A can be of multiple types), I'll create an enum class implementing the interface  StatusTask given below. 

And then, I'll call StatusTask.Chain.start(starting enum object, param);

public interface StatusTask&lt;T, V extends Enum&lt;V&gt; &amp; StatusTask&lt;T,V&gt;&gt;
{   
    public V execute(T t) throws Exception;

    public void fail(Exception e) throws Exception;

    public static class Chain
    {
        public static &lt;T,V extends Enum&lt;V&gt; &amp; StatusTask&lt;T,V&gt;&gt; void start(V v, T t)
        {
            V n = null;
            try
            {
                n = v.execute(t);
            }
            catch(Exception e)
            {
                v.fail(e);
            }

            if(n == null || n == v)
            {
                return;
            }

            start(n, t);
        }
    }
}


Do you see any significant flaws with this design?
Is there a better design to handle such a scenario?

Example Scenario: Fetching a file and processing it. Following are the task-status:
(0. Initial task. Move to Task 1.)


Send Request and mark status as Sent Request
Successful Response Received and mark status as Response Received and move to task 4
Error Response Received and mark status as Response Received
If file present, then mark status as Processing and execute step 4 else step 5
Mark status as File not available and exit
Parse file. If no error, goto step 7 else step 8
Mark status as File parsing succeeded and do something.....
Mark status as File parsing failed and exit
Single letter variable names are highly discouraged. A variable name should give a reader an idea about what value is stored in it. n, v, and t tells a reader nothing. v and n are the same type, but how would someone who hasn't seen the code before know which means what.



You are checking if n is null. The only way this can happen is if an exception is thrown in execute() or if execute() returnsnull`. In the first case, you can directly return from that catch block. Doing this will more clearly indicate that an exception will stop execution of the chain.

In the second case, that means that null is a valid return value from execute(). However, execute() returns an enum, which is a way to explicitly state all valid values. If null is a valid value, it would just be another state that should be explicitly stated.



The code doesn't have any documentation. While the interface is fairly simple, it does assume that a reader interpreters the signatures properly.


fail() takes an Exception as an argument. But what should the implementer do with this exception. The method can also thrown an exception, does that mean a valid implementation could be the following?

public void fail(Exception ex) throws Exception {
  throw ex;
}

If execute() returns the same enum value that it was passed, the chain of execution is stopped. This is extra logic that would not be clear to someone who hasn't seen the implementation. Since there is no documentation, someone needing to use this code has to look at the code to know that this is the way to stop execution.