I have the following structure:
public void someMethod(){
//DO SOME STUFF
try{
doSomeProcessing();
}
catch (Exception e){
As I understand your question you need to load data in an unpredictable but limited time interval. There are three possible ways to do so: 1) You could surround your call to loadSomeHeavyData with an if statement which controls the access to the method. 2) You could change your method to handle the control flow (decision to update or not) 3) Write an update thread and let it do the work for you The first two alternatives could use an external boolean value or generate a boolean decision by using the timedelta between the last call und the current calling time. Third alternative would be a timed thread which runs every n seconds/minutes and load the heavy data.