Java Timers - Messing up function called?
        Posted  
        
            by Matt Swanson
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Matt Swanson
        
        
        
        Published on 2010-03-13T02:14:11Z
        Indexed on 
            2010/03/13
            2:17 UTC
        
        
        Read the original article
        Hit count: 517
        
So I have a TimerTask task calling a function onTimerComplete() in its run()
onTimerComplete() looks something like this:
private void onTimerComplete(){
  myFunc1();
  myFunc2();
}
I make a Timer t and I schedule the TimerTask with t.schedule(task, 2000);
The problem is, when the timer is up and the task runs my onTimerComplete() but that function does not finish.  It runs myFunc1() but never finishes it nor does it ever call myFunc2()
However, if I call onTimerComplete() directly, everything works.
What's the deal here?
© Stack Overflow or respective owner