Esempio n. 1
0
  private void jobHandlerInvariants(
      ConcurrentLinkedDeque<TraceContext.Info> queue, CountInfo countInfo) {
    TraceContext.Info info1 = queue.pollFirst();
    TraceContext.Info info2 = queue.pollFirst();
    TraceContext.Info info3 = queue.pollFirst();
    assertEquals(info1.requestId, info2.requestId);
    assertEquals(info2.requestId, info3.requestId);
    assertEquals(info1.message, TraceContext.CONSTANT.REGISTER_THREAD_TO_REQUEST);
    assertEquals(info2.message, TraceContext.CONSTANT.START_NEW_TRACE);
    assertEquals(info3.message, TraceContext.CONSTANT.UNREGISTER_THREAD_FROM_REQUEST);

    putIfAbsent(countInfo.numberOfJobsMap, info1.requestId, 0);
    countInfo.numberOfJobsMap.put(
        info1.requestId, countInfo.numberOfJobsMap.get(info1.requestId) + 1);
  }
Esempio n. 2
0
  private void requestHandlerInvariants(
      ConcurrentLinkedDeque<TraceContext.Info> queue, CountInfo countInfo) {
    TraceContext.Info info1 = queue.pollFirst();
    TraceContext.Info info2 = queue.pollFirst();
    TraceContext.Info info3 = queue.pollFirst();
    TraceContext.Info info4 = queue.pollFirst();
    assertEquals(info1.requestId, info2.requestId);
    assertEquals(info2.requestId, info3.requestId);
    assertEquals(info3.requestId, info4.requestId);
    assertEquals(info1.message, TraceContext.CONSTANT.REGISTER_REQUEST);
    assertEquals(info2.message, TraceContext.CONSTANT.REGISTER_THREAD_TO_REQUEST);
    assertEquals(info3.message, TraceContext.CONSTANT.UNREGISTER_THREAD_FROM_REQUEST);
    assertEquals(info4.message, TraceContext.CONSTANT.UNREGISTER_REQUEST);

    countInfo.numberOfRequests.add(info1.requestId);
  }