java - Associating timer with tables -
i new timer's , don't know them .my problem creating 2 tables dynamically, , when ever table create timer 10 mins assigned it. i.e. user has fill table in 10 mins else table destroyed. tried making small demo in print stuff code :
final timer mytimers = new timer(); timer mytimers1 = new timer(); mytimers1 = new timer(); final long delay1 = 5*1000; // mytimers = new timer(); mytimers.schedule(new timertask() { long current1 = system.currenttimemillis(); long check = current1; @override public void run() { long current = system.currenttimemillis(); system.out.println(current); system.out.println("\n"); if((current1 + delay1)<current) { system.out.println("mytimmer stop"); mytimers.cancel(); } } }, 100, 1000); mytimers1.schedule(new timertask() { @override public void run() { long current = system.currenttimemillis(); system.out.println("in" + current); } }, delay1, 1000); }
but when tried implementing int final project not work have make variable inside run final , value can not changed !!! please let should !!thank you
i have make variable inside run final , value can not changed!
either turn these variables member variables or encapsulate these values in proper class, instantiate class , give reference object timer task.
even though reference final, timer task still able things such mytablecontroller.destroytable()
.
Comments
Post a Comment