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

20
LINES

< > BotCompany Repo | #1021911 // GazelleContextCache

JavaX fragment (include)

1  
sclass GazelleContextCache {
2  
  transient Lock lock = lock();
3  
  transient GazelleEvalContext cachedCtx;
4  
  
5  
  GazelleEvalContext get() {
6  
    lock lock;
7  
    GazelleEvalContext ctx = cachedCtx;
8  
    if (ctx == null) {
9  
      GazelleEvalContext _cachedCtx = dm_gazelle_stdEvalContext(dm_gazelle_allRulesWithComment("discord"));
10  
      cachedCtx = _cachedCtx;
11  
      ctx = gazelle_cloneCtx(_cachedCtx);
12  
    }
13  
    ret ctx;
14  
  }
15  
16  
  AutoCloseable listenToMessages() {
17  
    ret vmBus_onMessages(r { cachedCtx = null },
18  
      'gazelleRulesChanged, 'gazelleFeedbackChanged);
19  
  }
20  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021911
Snippet name: GazelleContextCache
Eternal ID of this version: #1021911/2
Text MD5: 0b48f276de6c062ed1bcb337189837f8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 15:26:25
Source code size: 581 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 194 / 658
Version history: 1 change(s)
Referenced in: [show references]