May 2017
Intermediate to advanced
414 pages
13h
English
If you run the preceding application, you will see the output as follows:
Sum of (1 +2) is 3 Hello, Sorry for disturbing you in every 2 seconds Hello, Sorry for disturbing you in every 2 seconds Hello, Sorry for disturbing you in every 2 seconds ....... and so on
Going through the code, we see that there are two methods in system.scheduler, that is, scheduleOnce and schedule. In the scheduleOnce method, we schedule the operation in such a way that it happens after a specified seed time but not repeatedly; in our case, it is 10 seconds. In the schedule method, we have scheduled the operation every 2 seconds, and it starts after the specified seed interval; in our case, the seed interval is 11 seconds.
Read now
Unlock full access