Setting outer variable from anonymous inner class

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)