Download Jar. Libraryless. Click here for Pure Java version (949L/7K).
1 | !7 |
2 | |
3 | p { |
4 | int poolSize = 4, queueSize = 10; |
5 | int keepAliveSeconds = 15; // how long idle threads are kept alive |
6 | |
7 | NotifyingBlockingThreadPoolExecutor threadPoolExecutor = new(poolSize, queueSize, keepAliveSeconds, TimeUnit.SECONDS); |
8 | |
9 | for (int i = 1; i <= 50; i++) { |
10 | final int _i = i; |
11 | threadPoolExecutor.execute(r { sleepSeconds(1); print(_i) }); |
12 | print("Queued " + i); |
13 | } |
14 | |
15 | threadPoolExecutor.shutdown(); |
16 | threadPoolExecutor.awaitTermination(1, TimeUnit.DAYS); |
17 | } |
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: | 725 / 1376 |
Version history: | 8 change(s) |
Referenced in: | [show references] |