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

23
LINES

< > BotCompany Repo | #1031572 // VMBusListenerWithLivelinessCheck

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2830L/17K).

1  
sclass VMBusListenerWithLivelinessCheck implements IF2<S, O, O> {
2  
  Set listeners; // where we were added
3  
  IF0<Bool> livelinessCheck;
4  
  O listener;
5  
  bool verbose;
6  
  
7  
  *(Set *listeners, IF0<Bool> *livelinessCheck, O *listener) {}
8  
  *(Set *listeners, IF0<Bool> *livelinessCheck, IVF2<S, O> *listener) {}
9  
  
10  
  public O get(S msg, O arg) {
11  
    bool live = false;
12  
    pcall {
13  
      live = livelinessCheck == null || livelinessCheck.get();
14  
    }
15  
    if (!live) {
16  
      if (verbose)
17  
        print VMBusListenerWithLivelinessCheck("Removing VM bus listener");
18  
      remove(listeners, this);
19  
      null;
20  
    }
21  
    ret callF(listener, msg, arg);
22  
  }
23  
}

Author comment

Began life as a copy of #1031569

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031572
Snippet name: VMBusListenerWithLivelinessCheck
Eternal ID of this version: #1031572/5
Text MD5: 57bc4dbe80961053c04c0b721ea8fea9
Transpilation MD5: 259ee4eb884267a664ca7a886c40325b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 04:56:44
Source code size: 666 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 168 / 337
Version history: 4 change(s)
Referenced in: [show references]