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

17
LINES

< > BotCompany Repo | #1011285 // Test if finally block is executed when thread is interrupted (it is!)

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

Download Jar. Libraryless. Click here for Pure Java version (1076L/8K).

1  
!7
2  
3  
static Lock lock = lock();
4  
5  
p {
6  
  lock lock;
7  
  Thread t = newThread(r {
8  
    try {
9  
      lock lock;
10  
    } finally {
11  
      print("Finally!");
12  
    }
13  
  });
14  
  startThread(t);
15  
  sleepSeconds(1);
16  
  t.interrupt();
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: #1011285
Snippet name: Test if finally block is executed when thread is interrupted (it is!)
Eternal ID of this version: #1011285/2
Text MD5: b4873ec146f314814cf4d6ae564c4b80
Transpilation MD5: ef3e078fb5054026dcbc5e171f0ff9ed
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-22 03:18:11
Source code size: 227 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 597 / 1423
Version history: 1 change(s)
Referenced in: [show references]