Libraryless. Click here for Pure Java version (3729L/20K).
sclass FixedRateTimer extends java.util.Timer implements AutoCloseable { *() { this(false); } *(bool daemon) { this(defaultTimerName(), daemon); } *(S name) { this(name, false); } *(S name, bool daemon) { super(name, daemon); _registerTimer(this); } L<Entry> entries = synchroList(); srecord noeq Entry(TimerTask task, long firstTime, long period) {} // Note: not all methods overridden; only use these ones public void scheduleAtFixedRate(TimerTask task, long delay, long period) { entries.add(new Entry(task, now()+delay, period)); super.scheduleAtFixedRate(task, delay, period); } public void cancel() { entries.clear(); super.cancel(); } public int purge() { entries.clear(); ret super.purge(); } FixedRateTimer changeRate(int newPeriod) { O r = ((SmartTimerTask) first(entries).task).r; cancel(); ret doEvery(newPeriod, r); } close { cancel(); } }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013151 |
Snippet name: | FixedRateTimer - java.util.Timer that remembers what it is doing |
Eternal ID of this version: | #1013151/12 |
Text MD5: | e7181b85f7e1b91c828e8f21a234d8ea |
Transpilation MD5: | f93beee3beb91e1cb932c537ab098e46 |
Author: | stefan |
Category: | javax / timers |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-01 22:53:44 |
Source code size: | 991 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 730 / 1529 |
Version history: | 11 change(s) |
Referenced in: | #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |