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).

sclass VMBusListenerWithLivelinessCheck implements IF2<S, O, O> {
  Set listeners; // where we were added
  IF0<Bool> livelinessCheck;
  O listener;
  bool verbose;
  
  *(Set *listeners, IF0<Bool> *livelinessCheck, O *listener) {}
  *(Set *listeners, IF0<Bool> *livelinessCheck, IVF2<S, O> *listener) {}
  
  public O get(S msg, O arg) {
    bool live = false;
    pcall {
      live = livelinessCheck == null || livelinessCheck.get();
    }
    if (!live) {
      if (verbose)
        print VMBusListenerWithLivelinessCheck("Removing VM bus listener");
      remove(listeners, this);
      null;
    }
    ret callF(listener, msg, arg);
  }
}

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: 230 / 418
Version history: 4 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)