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

22
LINES

< > BotCompany Repo | #1014337 // countDispatch

JavaX fragment (include)

sclass countDispatch_Data {
  int running;
  long invocations, totalTime;
}

static Map<S, countDispatch_Data> countDispatch_map = synchroMap();

static Closeable countDispatch(fS methodName) {
  countDispatch_Data data;
  synchronized(countDispatch_map) {
    data = countDispatch_map.get(methodName);
    if (data == null) countDispatch_map.put(methodName, data = new countDispatch_Data);
  }
  data.running++;
  final countDispatch_Data _data = data;
  final long time = sysNow();
  ret new Closeable { public void close {
    _data.totalTime += sysNow()-time;
    _data.running--;
    _data.invocations++;
  }};
}

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: #1014337
Snippet name: countDispatch
Eternal ID of this version: #1014337/2
Text MD5: 980ada37212057dd4a5a6a2e42505602
Author: stefan
Category: javax / monitoring
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-20 05:04:59
Source code size: 638 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 430
Version history: 1 change(s)
Referenced in: [show references]