Java doesn’t know that doWork is going to be synchronous and that the stack frame that result is in will still be there. You need to alter something that isn’t in the stack.
I think this would work
final Long[] result = new Long[1];
and then
result[0] = st.getLong(4);
in execute()
. At the end, you need to return result[0];
You might want to make a class because you don’t like how it looks to use an array here, but this is the basic idea.