Libraryless. Click here for Pure Java version (14291L/99K).
1 | !7 |
2 | |
3 | sclass DefunctACC extends DynModule { |
4 | JComponent visualize() { |
5 | ret hgrid(jbutton("Print", r actualUpdate), jbutton("Clean", r clean); |
6 | } |
7 | |
8 | void actualUpdate { |
9 | for (Thread t : allThreadsWithACC()) { |
10 | S desc = threadGroupName(t) + " / " + t.getName(); |
11 | AccessControlContext acc; |
12 | try { |
13 | acc = castGetOpt(t, 'inheritedAccessControlContext); |
14 | } catch { |
15 | continue with print("Can't see inside: " + desc); |
16 | } |
17 | if (acc == null) continue; |
18 | //print(acc_programIDs(acc) + ": " + desc); |
19 | L<S> defunctIDs = acc_defunctProgramIDs(acc); |
20 | if (nempty(defunctIDs)) |
21 | print("DEFUNCT! " + defunctIDs + ": " + desc); |
22 | } |
23 | } |
24 | |
25 | void clean { |
26 | for (Thread t : allThreadsWithACC()) pcall { |
27 | S desc = threadGroupName(t) + " / " + t.getName(); |
28 | AccessControlContext acc = castGetOpt(t, 'inheritedAccessControlContext); |
29 | if (acc == null) continue; |
30 | L<S> defunctIDs = acc_defunctProgramIDs(acc); |
31 | if (nempty(defunctIDs)) { |
32 | print("DEFUNCT! Cleaning. " + defunctIDs + ": " + desc); |
33 | set(t, inheritedAccessControlContext := AccessController.getContext()); // TODO: use global context |
34 | print("CLEANED."); |
35 | } |
36 | } |
37 | } |
38 | } |
Began life as a copy of #1016288
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: | #1016295 |
Snippet name: | Look for defunct AccessControlContext parts in all threads |
Eternal ID of this version: | #1016295/10 |
Text MD5: | 453143bfa343f7e79d85357cbb713950 |
Transpilation MD5: | 32a391eda2c8237473b8524978f50f7d |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-15 14:39:26 |
Source code size: | 1267 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 382 / 531 |
Version history: | 9 change(s) |
Referenced in: | [show references] |