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

19
LINES

< > BotCompany Repo | #1000568 // computerID - get (and optionally create) computer's ID

JavaX fragment (include)

1  
static String _computerID;
2  
static Lock computerID_lock = lock();
3  
4  
public static String computerID() {
5  
  if (_computerID == null) {
6  
    lock computerID_lock;
7  
    if (_computerID != null) ret _computerID;
8  
    File file = computerIDFile();
9  
    _computerID = loadTextFile(file.getPath());
10  
    if (_computerID == null) {
11  
      // legacy load
12  
      _computerID = loadTextFile(userDir(".tinybrain/computer-id"));
13  
      if (_computerID == null)
14  
        _computerID = makeRandomID(12, new SecureRandom);
15  
      saveTextFile(file, _computerID);
16  
    }
17  
  }
18  
  ret _computerID;
19  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000568
Snippet name: computerID - get (and optionally create) computer's ID
Eternal ID of this version: #1000568/10
Text MD5: 922e9293acc3f5345da2f3e283aa541b
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-22 12:42:54
Source code size: 582 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 869 / 3997
Version history: 9 change(s)
Referenced in: [show references]