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

18
LINES

< > BotCompany Repo | #1004559 // Test setDefaultUncaughtExceptionHandler [WORKS! :)]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1070L/7K/26K).

1  
!752
2  
3  
p {
4  
  Thread t = startThread("Bla", r { while licensed { sleep(100); } });
5  
  Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
6  
    public void uncaughtException(Thread t, Throwable e) {
7  
      print("Uncaught exception in " + t + "!");
8  
      S msg = getInnerMessage(e);
9  
      if (eq(msg, "Thread cancelled.")) {
10  
        print("Thread was cancelled.");
11  
        print(isThreadCancelled(t) ? "ok" : "what?");
12  
      } else
13  
        print("Message: " + msg);
14  
    }
15  
  });
16  
  cancelThread(t);
17  
  assertFalse(isThreadCancelled(currentThread()));
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004559
Snippet name: Test setDefaultUncaughtExceptionHandler [WORKS! :)]
Eternal ID of this version: #1004559/1
Text MD5: 0cbb9a91365ed927729383e177be0d73
Transpilation MD5: a10b9106f2451009e1e92cbcfd4a792b
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-21 15:05:20
Source code size: 590 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 582
Referenced in: [show references]