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

12
LINES

< > BotCompany Repo | #1007575 // autoCleanUpTimer - clean up a java.util.Timer on program clean-up - not really needed

JavaX fragment (include)

static Map<java.util.Timer, Bool> autoCleanUpTimer_timers = synchroMap(new WeakHashMap);

static java.util.Timer autoCleanUpTimer(java.util.Timer timer) {
  autoCleanUpTimer_timers.put(timer, true);
  ret timer;
}

static void cleanMeUp_autoCleanUpTimer() {
  for (java.util.Timer timer : keys(autoCleanUpTimer_timers))
    timer.cancel();
  autoCleanUpTimer_timers.clear();
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007575
Snippet name: autoCleanUpTimer - clean up a java.util.Timer on program clean-up - not really needed
Eternal ID of this version: #1007575/2
Text MD5: 1add2bb734c17fa364d16ae9b926ecf5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-27 13:52:40
Source code size: 387 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 442 / 451
Version history: 1 change(s)
Referenced in: [show references]