I have found myself wanting to do certain things in my programs only if a variable has changed. I have so far been doing something like this:
int x = 1;
in
Assuming you have multiple threads you could create an object monitor and wait for the changed object to wake all blocked threads.
Something like this:
private MyObject myObject;
... other thread ...
while(true) {
myObject.wait()
logic you want to run when notified.
}
... other thread ...
... later on ...
myObject.change();
myObject.notifyAll();