I've got a inner class in my class doing some asynchronous processing and setting value on parent class. Ex :
class Myclass{
String test;
public getTestValueFromMyClass(){
//this starts asynchronous processing on my inner class
}
//inner class
class InnerClass extends TimerTask{
//doing something asynchronously, when this process is done
test = "somevalue";
}
}
Now here is the problem from Runner class :
class Runner{
public static void main(String[] args){
Myclass instance = new Myclass();
//This is always null because runner class doesn't wait for Inner class to
//complete asynchronous processing and to set test value
System.out.println(instance.getTestValueFromMyClass());
}
}
How do I get around this?
threadPool.shutdown();the pool in my example. Just edited it.