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

38
LINES

< > BotCompany Repo | #1016295 // Look for defunct AccessControlContext parts in all threads

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14291L/99K).

!7

sclass DefunctACC extends DynModule {
  JComponent visualize() {
    ret hgrid(jbutton("Print", r actualUpdate), jbutton("Clean", r clean);
  }
  
  void actualUpdate {
    for (Thread t : allThreadsWithACC()) {
      S desc = threadGroupName(t) + " / " + t.getName();
      AccessControlContext acc;
      try {
        acc = castGetOpt(t, 'inheritedAccessControlContext);
      } catch {
        continue with print("Can't see inside: " + desc);
      }
      if (acc == null) continue;
      //print(acc_programIDs(acc) + ": " + desc);
      L<S> defunctIDs = acc_defunctProgramIDs(acc);
      if (nempty(defunctIDs))
        print("DEFUNCT! " + defunctIDs + ": " + desc);
    }
  }
  
  void clean {
    for (Thread t : allThreadsWithACC()) pcall {
      S desc = threadGroupName(t) + " / " + t.getName();
      AccessControlContext acc = castGetOpt(t, 'inheritedAccessControlContext);
      if (acc == null) continue;
      L<S> defunctIDs = acc_defunctProgramIDs(acc);
      if (nempty(defunctIDs)) {
        print("DEFUNCT! Cleaning. " + defunctIDs + ": " + desc);
        set(t, inheritedAccessControlContext := AccessController.getContext()); // TODO: use global context
        print("CLEANED.");
      }
    }
  }
}

Author comment

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: 311 / 436
Version history: 9 change(s)
Referenced in: