io.perfmark.PerfMark Java Examples

The following examples show how to use io.perfmark.PerfMark. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MigratingThreadDeframer.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void requestFromTransportThread(final int numMessages) {
  class RequestAgainOp implements Op {
    @Override public void run(boolean isDeframerOnTransportThread) {
      if (!isDeframerOnTransportThread) {
        // State changed. Go back and try again
        request(numMessages);
        return;
      }
      try {
        deframer.request(numMessages);
      } catch (Throwable t) {
        appListener.deframeFailed(t);
        deframer.close(); // unrecoverable state
      }
      if (!deframer.hasPendingDeliveries()) {
        synchronized (lock) {
          PerfMark.event("MigratingThreadDeframer.deframerOnApplicationThread");
          migratingListener.setDelegate(appListener);
          deframerOnTransportThread = false;
        }
      }
    }
  }

  runWhereAppropriate(new RequestAgainOp());
}
 
Example #2
Source File: PerfMarkTransformerTest.java    From perfmark with Apache License 2.0 6 votes vote down vote up
@Test
public void transform_methodRef() throws Exception {
  PerfMark.setEnabled(true);
  Storage.resetForTest();

  final class ClzLocal {
    public ClzLocal() {
      @SuppressWarnings("unused")
      Object o = execute(PerfMark::linkOut);
    }

    Link execute(Supplier<Link> supplier) {
      return supplier.get();
    }
  }

  Class<?> clz = transformAndLoad(ClzLocal.class);
  Constructor<?> ctor = clz.getConstructor(PerfMarkTransformerTest.class);
  ctor.setAccessible(true);
  ctor.newInstance(this);
  List<Mark> marks = Storage.readForTest();
  assertThat(marks).hasSize(1);
  // I'm not sure what to do with methodrefs, so just leave it alone for now.
}
 
Example #3
Source File: PerfMarkTransformerTest.java    From perfmark with Apache License 2.0 6 votes vote down vote up
@Test
public void transform_toplevel() throws Exception {
  PerfMark.setEnabled(true);
  Storage.resetForTest();

  Class<?> clz = transformAndLoad(ClzFooter.class);
  Constructor<?> ctor = clz.getDeclaredConstructor();
  ctor.setAccessible(true);
  ctor.newInstance();
  List<Mark> marks = Storage.readForTest();
  assertThat(marks).hasSize(4);
  for (Mark mark : marks) {
    assertNotNull(mark.getMarker());
    StackTraceElement element = Internal.getElement(mark.getMarker());
    assertThat(element.getClassName()).isEqualTo(ClzFooter.class.getName());
    assertThat(element.getMethodName()).isEqualTo("<init>");
    assertThat(element.getFileName()).isEqualTo("PerfMarkTransformerTest.java");
    assertThat(element.getLineNumber()).isGreaterThan(0);
  }
}
 
Example #4
Source File: ServerCallImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void sendMessage_serverSendsOne_closeOnSecondCall(
    MethodDescriptor<Long, Long> method) {
  ServerCallImpl<Long, Long> serverCall = new ServerCallImpl<>(
      stream,
      method,
      requestHeaders,
      context,
      DecompressorRegistry.getDefaultInstance(),
      CompressorRegistry.getDefaultInstance(),
      serverCallTracer,
      PerfMark.createTag());
  serverCall.sendHeaders(new Metadata());
  serverCall.sendMessage(1L);
  verify(stream, times(1)).writeMessage(any(InputStream.class));
  verify(stream, never()).close(any(Status.class), any(Metadata.class));

  // trying to send a second message causes gRPC to close the underlying stream
  serverCall.sendMessage(1L);
  verify(stream, times(1)).writeMessage(any(InputStream.class));
  ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
  verify(stream, times(1)).cancel(statusCaptor.capture());
  assertEquals(Status.Code.INTERNAL, statusCaptor.getValue().getCode());
  assertEquals(ServerCallImpl.TOO_MANY_RESPONSES, statusCaptor.getValue().getDescription());
}
 
Example #5
Source File: OkHttpClientStream.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
public void writeHeaders(Metadata metadata, byte[] payload) {
  PerfMark.startTask("OkHttpClientStream$Sink.writeHeaders");
  String defaultPath = "/" + method.getFullMethodName();
  if (payload != null) {
    useGet = true;
    defaultPath += "?" + BaseEncoding.base64().encode(payload);
  }
  try {
    synchronized (state.lock) {
      state.streamReady(metadata, defaultPath);
    }
  } finally {
    PerfMark.stopTask("OkHttpClientStream$Sink.writeHeaders");
  }
}
 
Example #6
Source File: PerfMarkTransformerTest.java    From perfmark with Apache License 2.0 6 votes vote down vote up
@Test
public void transform_clinit() throws Exception {
  PerfMark.setEnabled(true);
  Storage.resetForTest();

  Class<?> clz = transformAndLoad(ClzWithClinit.class);
  Constructor<?> ctor = clz.getDeclaredConstructor();
  ctor.setAccessible(true);
  ctor.newInstance();
  List<Mark> marks = Storage.readForTest();
  assertThat(marks).hasSize(4);
  for (Mark mark : marks) {
    assertNotNull(mark.getMarker());
    StackTraceElement element = Internal.getElement(mark.getMarker());
    assertThat(element.getClassName()).isEqualTo(ClzWithClinit.class.getName());
    assertThat(element.getMethodName()).isEqualTo("<clinit>");
    assertThat(element.getFileName()).isEqualTo("PerfMarkTransformerTest.java");
    assertThat(element.getLineNumber()).isGreaterThan(0);
  }
}
 
Example #7
Source File: OkHttpClientTransport.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
public void rstStream(int streamId, ErrorCode errorCode) {
  logger.logRstStream(OkHttpFrameLogger.Direction.INBOUND, streamId, errorCode);
  Status status = toGrpcStatus(errorCode).augmentDescription("Rst Stream");
  boolean stopDelivery =
      (status.getCode() == Code.CANCELLED || status.getCode() == Code.DEADLINE_EXCEEDED);
  synchronized (lock) {
    OkHttpClientStream stream = streams.get(streamId);
    if (stream != null) {
      PerfMark.event("OkHttpClientTransport$ClientFrameHandler.rstStream",
          stream.transportState().tag());
      finishStream(
          streamId, status,
          errorCode == ErrorCode.REFUSED_STREAM ? RpcProgress.REFUSED : RpcProgress.PROCESSED,
          stopDelivery, null, null);
    }
  }
}
 
Example #8
Source File: ServerImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void messageRead_runtimeExceptionCancelsCall() throws Exception {
  JumpToApplicationThreadServerStreamListener listener
      = new JumpToApplicationThreadServerStreamListener(
          executor.getScheduledExecutorService(),
          executor.getScheduledExecutorService(),
          stream,
          Context.ROOT.withCancellation(),
          PerfMark.createTag());
  ServerStreamListener mockListener = mock(ServerStreamListener.class);
  listener.setListener(mockListener);

  RuntimeException expectedT = new RuntimeException();
  doThrow(expectedT).when(mockListener)
      .messagesAvailable(any(StreamListener.MessageProducer.class));
  // Closing the InputStream is done by the delegated listener (generally ServerCallImpl)
  listener.messagesAvailable(mock(StreamListener.MessageProducer.class));
  try {
    executor.runDueTasks();
    fail("Expected exception");
  } catch (RuntimeException t) {
    assertSame(expectedT, t);
    ensureServerStateNotLeaked();
  }
}
 
Example #9
Source File: BaseZuulFilterRunner.java    From zuul with Apache License 2.0 6 votes vote down vote up
protected final void invokeNextStage(final O zuulMesg, final HttpContent chunk) {
    if (nextStage != null) {
        PerfMark.startTask(getClass().getName(), "invokeNextStageChunk");
        try {
            addPerfMarkTags(zuulMesg);
            nextStage.filter(zuulMesg, chunk);
        } finally {
            PerfMark.stopTask(getClass().getName(), "invokeNextStageChunk");
        }
    } else {
        //Next stage is Netty channel handler
        PerfMark.startTask(getClass().getName(), "fireChannelReadChunk");
        try {
            addPerfMarkTags(zuulMesg);
            getChannelHandlerContext(zuulMesg).fireChannelRead(chunk);
        } finally {
            PerfMark.stopTask(getClass().getName(), "fireChannelReadChunk");
        }
    }
}
 
Example #10
Source File: NettyServerStream.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
public void runOnTransportThread(final Runnable r) {
  if (eventLoop.inEventLoop()) {
    r.run();
  } else {
    final Link link = PerfMark.linkOut();
    eventLoop.execute(new Runnable() {
      @Override
      public void run() {
        PerfMark.startTask("NettyServerStream$TransportState.runOnTransportThread", tag);
        PerfMark.linkIn(link);
        try {
          r.run();
        } finally {
          PerfMark.stopTask("NettyServerStream$TransportState.runOnTransportThread", tag);
        }
      }
    });
  }
}
 
Example #11
Source File: ServerImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void messageRead_errorCancelsCall() throws Exception {
  JumpToApplicationThreadServerStreamListener listener
      = new JumpToApplicationThreadServerStreamListener(
          executor.getScheduledExecutorService(),
          executor.getScheduledExecutorService(),
          stream,
          Context.ROOT.withCancellation(),
          PerfMark.createTag());
  ServerStreamListener mockListener = mock(ServerStreamListener.class);
  listener.setListener(mockListener);

  TestError expectedT = new TestError();
  doThrow(expectedT).when(mockListener)
      .messagesAvailable(any(StreamListener.MessageProducer.class));
  // Closing the InputStream is done by the delegated listener (generally ServerCallImpl)
  listener.messagesAvailable(mock(StreamListener.MessageProducer.class));
  try {
    executor.runDueTasks();
    fail("Expected exception");
  } catch (TestError t) {
    assertSame(expectedT, t);
    ensureServerStateNotLeaked();
  }
}
 
Example #12
Source File: NettyServerHandler.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void onRstStreamRead(int streamId, long errorCode) throws Http2Exception {
  try {
    NettyServerStream.TransportState stream = serverStream(connection().stream(streamId));
    if (stream != null) {
      PerfMark.startTask("NettyServerHandler.onRstStreamRead", stream.tag());
      try {
        stream.transportReportStatus(
            Status.CANCELLED.withDescription("RST_STREAM received for code " + errorCode));
      } finally {
        PerfMark.stopTask("NettyServerHandler.onRstStreamRead", stream.tag());
      }
    }
  } catch (Throwable e) {
    logger.log(Level.WARNING, "Exception in onRstStreamRead()", e);
    // Throw an exception that will get handled by onStreamError.
    throw newStreamException(streamId, e);
  }
}
 
Example #13
Source File: NettyServerHandler.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void forcefulClose(final ChannelHandlerContext ctx, final ForcefulCloseCommand msg,
    ChannelPromise promise) throws Exception {
  super.close(ctx, promise);
  connection().forEachActiveStream(new Http2StreamVisitor() {
    @Override
    public boolean visit(Http2Stream stream) throws Http2Exception {
      NettyServerStream.TransportState serverStream = serverStream(stream);
      if (serverStream != null) {
        PerfMark.startTask("NettyServerHandler.forcefulClose", serverStream.tag());
        PerfMark.linkIn(msg.getLink());
        try {
          serverStream.transportReportStatus(msg.getStatus());
          resetStream(ctx, stream.id(), Http2Error.CANCEL.code(), ctx.newPromise());
        } finally {
          PerfMark.stopTask("NettyServerHandler.forcefulClose", serverStream.tag());
        }
      }
      stream.close();
      return true;
    }
  });
}
 
Example #14
Source File: NettyServerHandler.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
protected void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
    StreamException http2Ex) {
  logger.log(Level.WARNING, "Stream Error", cause);
  NettyServerStream.TransportState serverStream = serverStream(
      connection().stream(Http2Exception.streamId(http2Ex)));
  Tag tag = serverStream != null ? serverStream.tag() : PerfMark.createTag();
  PerfMark.startTask("NettyServerHandler.onStreamError", tag);
  try {
    if (serverStream != null) {
      serverStream.transportReportStatus(Utils.statusFromThrowable(cause));
    }
    // TODO(ejona): Abort the stream by sending headers to help the client with debugging.
    // Delegate to the base class to send a RST_STREAM.
    super.onStreamError(ctx, outbound, cause, http2Ex);
  } finally {
    PerfMark.stopTask("NettyServerHandler.onStreamError", tag);
  }
}
 
Example #15
Source File: ServerImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void halfClosed_runtimeExceptionCancelsCall() {
  JumpToApplicationThreadServerStreamListener listener
      = new JumpToApplicationThreadServerStreamListener(
          executor.getScheduledExecutorService(),
          executor.getScheduledExecutorService(),
          stream,
          Context.ROOT.withCancellation(),
          PerfMark.createTag());
  ServerStreamListener mockListener = mock(ServerStreamListener.class);
  listener.setListener(mockListener);

  RuntimeException expectedT = new RuntimeException();
  doThrow(expectedT).when(mockListener).halfClosed();
  listener.halfClosed();
  try {
    executor.runDueTasks();
    fail("Expected exception");
  } catch (RuntimeException t) {
    assertSame(expectedT, t);
    ensureServerStateNotLeaked();
  }
}
 
Example #16
Source File: ServerCallImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void serverSendsOne_okFailsOnMissingResponse(
    MethodDescriptor<Long, Long> method) {
  ServerCallImpl<Long, Long> serverCall = new ServerCallImpl<>(
      stream,
      method,
      requestHeaders,
      context,
      DecompressorRegistry.getDefaultInstance(),
      CompressorRegistry.getDefaultInstance(),
      serverCallTracer,
      PerfMark.createTag());
  serverCall.close(Status.OK, new Metadata());
  ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
  verify(stream, times(1)).cancel(statusCaptor.capture());
  assertEquals(Status.Code.INTERNAL, statusCaptor.getValue().getCode());
  assertEquals(ServerCallImpl.MISSING_RESPONSE, statusCaptor.getValue().getDescription());
}
 
Example #17
Source File: BaseZuulFilterRunner.java    From zuul with Apache License 2.0 6 votes vote down vote up
protected final void invokeNextStage(final O zuulMesg) {
    if (nextStage != null) {
        PerfMark.startTask(getClass().getName(), "invokeNextStage");
        try {
            addPerfMarkTags(zuulMesg);
            nextStage.filter(zuulMesg);
        } finally {
            PerfMark.stopTask(getClass().getName(), "invokeNextStage");
        }
    } else {
        //Next stage is Netty channel handler
        PerfMark.startTask(getClass().getName(), "fireChannelRead");
        try {
            addPerfMarkTags(zuulMesg);
            getChannelHandlerContext(zuulMesg).fireChannelRead(zuulMesg);
        } finally {
            PerfMark.stopTask(getClass().getName(), "fireChannelRead");
        }
    }
}
 
Example #18
Source File: BaseZuulFilterRunner.java    From zuul with Apache License 2.0 6 votes vote down vote up
@Override
public void onNext(O outMesg) {
    boolean stopped = false;
    PerfMark.startTask(filter.filterName(), "onNextAsync");
    try {
        PerfMark.linkIn(onNextLinkOut.get());
        addPerfMarkTags(inMesg);
        recordFilterCompletion(SUCCESS, filter, startTime, inMesg, snapshot);
        if (outMesg == null) {
            outMesg = filter.getDefaultOutput(inMesg);
        }
        stopped = true;
        PerfMark.stopTask(filter.filterName(), "onNextAsync");
        resumeInBindingContext(outMesg, filter.filterName());
    }
    catch (Exception e) {
        decrementConcurrency();
        handleException(inMesg, filter.filterName(), e);
    } finally {
        if (!stopped) {
            PerfMark.stopTask(filter.filterName(), "onNextAsync");
        }
    }
}
 
Example #19
Source File: NettyClientHandler.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
private void forcefulClose(final ChannelHandlerContext ctx, final ForcefulCloseCommand msg,
    ChannelPromise promise) throws Exception {
  // close() already called by NettyClientTransport, so just need to clean up streams
  connection().forEachActiveStream(new Http2StreamVisitor() {
    @Override
    public boolean visit(Http2Stream stream) throws Http2Exception {
      NettyClientStream.TransportState clientStream = clientStream(stream);
      Tag tag = clientStream != null ? clientStream.tag() : PerfMark.createTag();
      PerfMark.startTask("NettyClientHandler.forcefulClose", tag);
      PerfMark.linkIn(msg.getLink());
      try {
        if (clientStream != null) {
          clientStream.transportReportStatus(msg.getStatus(), true, new Metadata());
          resetStream(ctx, stream.id(), Http2Error.CANCEL.code(), ctx.newPromise());
        }
        stream.close();
        return true;
      } finally {
        PerfMark.stopTask("NettyClientHandler.forcefulClose", tag);
      }
    }
  });
  promise.setSuccess();
}
 
Example #20
Source File: MigratingThreadDeframer.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Override
public InputStream next() {
  while (true) {
    InputStream is = appListener.messageReadQueuePoll();
    if (is != null) {
      return is;
    }
    Op op;
    synchronized (lock) {
      op = opQueue.poll();
      if (op == null) {
        if (deframer.hasPendingDeliveries()) {
          PerfMark.event("MigratingThreadDeframer.deframerOnTransportThread");
          migratingListener.setDelegate(transportListener);
          deframerOnTransportThread = true;
        }
        messageProducerEnqueued = false;
        return null;
      }
    }
    op.run(/*isDeframerOnTransportThread=*/false);
  }
}
 
Example #21
Source File: NettyClientHandler.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
/**
 * Cancels this stream.
 */
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd,
    ChannelPromise promise) {
  NettyClientStream.TransportState stream = cmd.stream();
  PerfMark.startTask("NettyClientHandler.cancelStream", stream.tag());
  PerfMark.linkIn(cmd.getLink());
  try {
    Status reason = cmd.reason();
    if (reason != null) {
      stream.transportReportStatus(reason, true, new Metadata());
    }
    if (!cmd.stream().isNonExistent()) {
      encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise);
    } else {
      promise.setSuccess();
    }
  } finally {
    PerfMark.stopTask("NettyClientHandler.cancelStream", stream.tag());
  }
}
 
Example #22
Source File: ServerImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void onReady_errorCancelsCall() {
  JumpToApplicationThreadServerStreamListener listener
      = new JumpToApplicationThreadServerStreamListener(
          executor.getScheduledExecutorService(),
          executor.getScheduledExecutorService(),
          stream,
          Context.ROOT.withCancellation(),
          PerfMark.createTag());
  ServerStreamListener mockListener = mock(ServerStreamListener.class);
  listener.setListener(mockListener);

  TestError expectedT = new TestError();
  doThrow(expectedT).when(mockListener).onReady();
  listener.onReady();
  try {
    executor.runDueTasks();
    fail("Expected exception");
  } catch (TestError t) {
    assertSame(expectedT, t);
    ensureServerStateNotLeaked();
  }
}
 
Example #23
Source File: ServerImplTest.java    From grpc-java with Apache License 2.0 6 votes vote down vote up
@Test
public void onReady_runtimeExceptionCancelsCall() {
  JumpToApplicationThreadServerStreamListener listener
      = new JumpToApplicationThreadServerStreamListener(
          executor.getScheduledExecutorService(),
          executor.getScheduledExecutorService(),
          stream,
          Context.ROOT.withCancellation(),
          PerfMark.createTag());
  ServerStreamListener mockListener = mock(ServerStreamListener.class);
  listener.setListener(mockListener);

  RuntimeException expectedT = new RuntimeException();
  doThrow(expectedT).when(mockListener).onReady();
  listener.onReady();
  try {
    executor.runDueTasks();
    fail("Expected exception");
  } catch (RuntimeException t) {
    assertSame(expectedT, t);
    ensureServerStateNotLeaked();
  }
}
 
Example #24
Source File: PerfMarkTransformerTest.java    From perfmark with Apache License 2.0 6 votes vote down vote up
@Test
public void transform_auto() throws Exception {
  PerfMark.setEnabled(true);
  Storage.resetForTest();

  Class<?> clz = transformAndLoad(ClzAutoRecord.class);
  Constructor<?> ctor = clz.getConstructor();
  ctor.setAccessible(true);
  ctor.newInstance();
  List<Mark> marks = Storage.readForTest();
  assertThat(marks).hasSize(2);
  for (Mark mark : marks) {
    assertNotNull(mark.getMarker());
    StackTraceElement element = Internal.getElement(mark.getMarker());
    assertThat(element.getClassName()).isEqualTo(ClzAutoRecord.class.getName());
    assertThat(element.getMethodName()).isEqualTo("recordMe");
    assertThat(element.getFileName()).isEqualTo("PerfMarkTransformerTest.java");
    // TODO: reenable.
    // assertThat(element.getLineNumber()).isGreaterThan(0);
  }
}
 
Example #25
Source File: BaseZuulFilterRunner.java    From zuul with Apache License 2.0 5 votes vote down vote up
private Action1<Throwable> onErrorStarted(Link onErrorLinkIn) {
    return t -> {
        PerfMark.startTask(filter.filterName(), "onError");
        try {
            PerfMark.linkIn(onErrorLinkIn);
            onErrorLinkOut.compareAndSet(null, PerfMark.linkOut());
        } finally {
            PerfMark.stopTask(filter.filterName(), "onError");                }
    };
}
 
Example #26
Source File: ServerCallImpl.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public void halfClosed() {
  PerfMark.startTask("ServerStreamListener.halfClosed", call.tag);
  try {
    if (call.cancelled) {
      return;
    }

    listener.onHalfClose();
  } finally {
    PerfMark.stopTask("ServerStreamListener.halfClosed", call.tag);
  }
}
 
Example #27
Source File: ServerCallImpl.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public void closed(Status status) {
  PerfMark.startTask("ServerStreamListener.closed", call.tag);
  try {
    closedInternal(status);
  } finally {
    PerfMark.stopTask("ServerStreamListener.closed", call.tag);
  }
}
 
Example #28
Source File: ServerCallImpl.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public void onReady() {
  PerfMark.startTask("ServerStreamListener.onReady", call.tag);
  try {
    if (call.cancelled) {
      return;
    }
    listener.onReady();
  } finally {
    PerfMark.stopTask("ServerCall.closed", call.tag);
  }
}
 
Example #29
Source File: ServerImpl.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public void halfClosed() {
  PerfMark.startTask("ServerStreamListener.halfClosed", tag);
  final Link link = PerfMark.linkOut();

  final class HalfClosed extends ContextRunnable {
    HalfClosed() {
      super(context);
    }

    @Override
    public void runInContext() {
      PerfMark.startTask("ServerCallListener(app).halfClosed", tag);
      PerfMark.linkIn(link);
      try {
        getListener().halfClosed();
      } catch (Throwable t) {
        internalClose(t);
        throw t;
      } finally {
        PerfMark.stopTask("ServerCallListener(app).halfClosed", tag);
      }
    }
  }

  try {
    callExecutor.execute(new HalfClosed());
  } finally {
    PerfMark.stopTask("ServerStreamListener.halfClosed", tag);
  }
}
 
Example #30
Source File: ServerImpl.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
@Override
public void streamCreated(ServerStream stream, String methodName, Metadata headers) {
  Tag tag = PerfMark.createTag(methodName, stream.streamId());
  PerfMark.startTask("ServerTransportListener.streamCreated", tag);
  try {
    streamCreatedInternal(stream, methodName, headers, tag);
  } finally {
    PerfMark.stopTask("ServerTransportListener.streamCreated", tag);
  }
}