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

8
LINES

< > BotCompany Repo | #1016550 // withMinTime - sleep if code executed shorter than x milliseconds (sleeps also in case of exception)

JavaX fragment (include)

1  
svoid withMinTime(long minTime, Runnable r) {
2  
  long destTime = sysNow()+minTime;
3  
  try {
4  
    callF(r);
5  
  } finally {
6  
    sleepUntilSysTime(destTime);
7  
  }
8  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016550
Snippet name: withMinTime - sleep if code executed shorter than x milliseconds (sleeps also in case of exception)
Eternal ID of this version: #1016550/6
Text MD5: cc54be3d427e3d47bd5d76a8d6470a40
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-23 14:53:09
Source code size: 163 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 424
Version history: 5 change(s)
Referenced in: [show references]