Download Jar. Libraryless. Click here for Pure Java version (949L/7K).
!7 p { int poolSize = 4, queueSize = 10; int keepAliveSeconds = 15; // how long idle threads are kept alive NotifyingBlockingThreadPoolExecutor threadPoolExecutor = new(poolSize, queueSize, keepAliveSeconds, TimeUnit.SECONDS); for (int i = 1; i <= 50; i++) { final int _i = i; threadPoolExecutor.execute(r { sleepSeconds(1); print(_i) }); print("Queued " + i); } threadPoolExecutor.shutdown(); threadPoolExecutor.awaitTermination(1, TimeUnit.DAYS); }
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: | #1011719 | 
| Snippet name: | Test NotifyingBlockingThreadPoolExecutor (OK!) | 
| Eternal ID of this version: | #1011719/9 | 
| Text MD5: | f5c2c368974f54f365a9f62de0b6edc8 | 
| Transpilation MD5: | 03327c3652745dbbae0056f3a2c7da61 | 
| Author: | stefan | 
| Category: | javax / concurrency | 
| Type: | JavaX source code (desktop) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2017-11-03 16:43:23 | 
| Source code size: | 501 bytes / 17 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 964 / 1932 | 
| Version history: | 8 change(s) | 
| Referenced in: | [show references] |