Gemalto is now part of the Thales Group, find out more.

You are here

Timer and TimerTask usage | Thales IoT Developer Community


February 9, 2017 - 11:13am, 1252 views


I have time scheduled events in my application and I'm using Timer and TimerTask classes for this purpose.

I didn't see any example or question about this issue on forum.

Is there any other way of realizing time scheduled events without using this pair of classes? (Except Thread.sleep() method.)

Is there  an application note about how to use these classes?

I don't know how jvm creates and uses timers at low level but embedded devices has limited number of timers in their architecture. Thus, a limit is necessary for Timer object creation excluding memory constraints.

So, is there a limit for Timer object creation for modules, in my case BGS5? I'm using 6 Timer object always alive in my application and each Timer object is schedules a separate TimerTask object. That is, 6 Timer and 6 TimerTask object. Is this a proper usage? Maybe only one Timer is enough for all TimerTasks.

Best Regards,