I'm working in an Android project with multithreading. Basically I have to wait to the server to respond before sending more data.
The data sending task is delimited by the flag
boolean hasServerResponded so the
Thread will loop infinitely without doing anything until the flag becomes
boolean isn't declared as
volatile (yet), and also looping without doing anything wastes resources, I thought maybe I should use
AtomicBoolean and also implement
wait() / notify() mechanism.
Should I use the
wait() methods or should I create a lock