Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1004683 // doEvery - install a java.util.Timer

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2419L/16K).

// firstDelay = delay
static FixedRateTimer doEvery(long delay, final O r) {
  ret doEvery(delay, delay, r);
}

static FixedRateTimer doEvery(long delay, long firstDelay, final O r) {
  FixedRateTimer timer = new(shorten(programID() + ": " + r, 80));
  timer.scheduleAtFixedRate(smartTimerTask(r, timer, toInt(delay)), toInt(firstDelay), toInt(delay));
  ret vmBus_timerStarted(timer);
}

// reversed argument order for fun
static FixedRateTimer doEvery(double initialSeconds, double delaySeconds, final O r) {
  ret doEvery(toMS(delaySeconds), toMS(initialSeconds), r);
}

static FixedRateTimer doEvery(double delaySeconds, final O r) {
  ret doEvery(toMS(delaySeconds), r);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004683
Snippet name: doEvery - install a java.util.Timer
Eternal ID of this version: #1004683/11
Text MD5: 782e2f2e74c2c91a3299d9098b7319f7
Transpilation MD5: 9ce35c1eb57e641a7ebd2ae0c2b645bf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-23 13:48:17
Source code size: 697 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 902 / 989
Version history: 10 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018683 - atTheStartOfEveryHour - install a java.util.Timer
#1027275 - dm_doEvery - install a java.util.Timer
#1032668 - doEvery_stopOnException - install a java.util.Timer, stop it when executed code throws an exception