So, I set my timer:
timer.scheduleAtFixedRate(new TimerTask()
{
@Override
public void run()
{
...
}
}, 5, 5);
so I want to trigger this run()
for testing something, not wait until it gets triggered. Is there a way?
why using executors or threads? its not enough* to run method? :)
// define task
TimerTask = tt new TimerTask()
{
@Override
public void run()
{
...
}
};
// schedule
timer.scheduleAtFixedRate(tt,int,int);
// run as any other method :)
tt.run();
*when run is not enought? when we can't or don't want to block the current thread!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With