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

40
LINES

< > BotCompany Repo | #1019633 // VM Bus Snooper - disabled, needs rewrite

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

Uses 1113K of libraries. Click here for Pure Java version (6632L/32K).

1  
!7
2  
3  
// TODO: This is still super easy to crash
4  
// as it tries to record every internal VM bus message
5  
// for things like threads and locks. We need a different
6  
// approach here - just collect in a list!?
7  
8  
cmodule2 VMBusSnooper > DynPrintLog {
9  
  switchable bool enabled;
10  
  switchable bool logToDisk;
11  
  switchable bool showStackTraces;
12  
  switchable S filter = ""; // regular expression
13  
  
14  
  start {
15  
    q(); // make sure to create queue because creating it
16  
         // while handling a VM bus message is really bad
17  
    /*dm_vmBus_onAnyMessage(voidfunc(fS msg, fO _arg) {
18  
      if (!enabled || empty(filter)) ret;
19  
      Throwable stackTrace = showStackTraces ? new Throwable : null;
20  
      switch to q();
21  
      O arg = _arg;
22  
      if (!regexpFindIC(filter, msg)) ret;
23  
      if (arg instanceof O[]) arg = joinWithComma(allToString((O[]) arg));
24  
      S s = msg + (arg == null ? "" : " | " + arg);
25  
      print(localTimeWithSeconds() + " " + shorten(s, 200));
26  
      if (logToDisk)
27  
        programLog(shorten(s, 1024));
28  
      if (stackTrace != null)
29  
        printStackTrace(stackTrace);
30  
    });*/
31  
  }
32  
  
33  
  visual centerAndSouthWithMargins(super,
34  
    centerAndEastWithMargin(dm_fieldWithLabel filter(),
35  
      jline(
36  
        dm_fieldCheckBox logToDisk(),
37  
        dm_fieldCheckBox showStackTraces(),
38  
        dm_fieldCheckBox enabled())))
39  
;
40  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019633
Snippet name: VM Bus Snooper - disabled, needs rewrite
Eternal ID of this version: #1019633/24
Text MD5: 8900efc833e29ad5a31bca39a12f2d84
Transpilation MD5: 890e1695c75219e541ac7c7150690af3
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 21:26:54
Source code size: 1368 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 402 / 5180
Version history: 23 change(s)
Referenced in: [show references]