// r may return false to cancel timer static TimerTask smartTimerTask(O r, java.util.Timer timer, long delay) { ret SmartTimerTask(r, timer, delay, _threadInfo()); } srecord noeq SmartTimerTask(O r, java.util.Timer timer, long delay, O threadInfo) extends TimerTask { long lastRun; public void run() { if (!licensed()) timer.cancel(); else { _threadInheritInfo(threadInfo); temp tempActivity(r); lastRun = fixTimestamp(lastRun); long now = now(); if (now >= lastRun + delay*0.9) { lastRun = now; if (eq(false, pcallF(r))) timer.cancel(); } } } }
Began life as a copy of #1004684
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1006311 |
| Snippet name: | smartTimerTask - create TimerTask with automatic fix for hibernation problem & automatic cancellation on program clean-up |
| Eternal ID of this version: | #1006311/10 |
| Text MD5: | 2b83f745aab8832d15e5dcb5e1972889 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-06-26 13:35:15 |
| Source code size: | 660 bytes / 24 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 845 / 929 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |