Edited: I need to change the values of several variables as they run several times thorugh a timer. I need to keep updating the values with every iteration through the timer
If you want to change a value in a method call within an anonymous class, that "value" is actually a Future
. So, if you use Guava, you can write
...
final SettableFuture myvalue = SettableFuture.create();
...
someclass.run(new Runnable(){
public void run(){
...
myvalue.set(value);
...
}
}
return myvalue.get();