Check if LockedExternalTask is ready


I have an external task thread which I pass an instance of LockedExternalTask, which I get from the fetchAndLock() method. I occasionally get a NullValueException while working with the task, and would like to know what is the best way to ensure that a LockedExternalTask is ready to go before trying to do any work on it?

Something similar to a task.isReady() or something similar? It seems like the execution is often still in transaction by the time a task is locked by my worker thread.

Thank you!