Thursday, 15 March 2012

Trigger a run() method of Timer of Java manually -



Trigger a run() method of Timer of Java manually -

so, set timer:

timer.scheduleatfixedrate(new timertask() { @override public void run() { ... } }, 5, 5);

so want trigger run() testing something, not wait until gets triggered. there way?

just create runnable object before (not using anonymus class) , utilize create new thread , start it.

something

runnable runnable = new runnable() { @override public void run() { /*impl*/ } }; new thread(runnable).start();

java

No comments:

Post a Comment