All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.instrumentation.playws.v1_0.StreamedAsyncHandlerWrapper Maven / Gradle / Ivy

The newest version!
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.instrumentation.playws.v1_0;

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import org.reactivestreams.Publisher;
import play.shaded.ahc.org.asynchttpclient.HttpResponseBodyPart;
import play.shaded.ahc.org.asynchttpclient.Request;
import play.shaded.ahc.org.asynchttpclient.handler.StreamedAsyncHandler;

public class StreamedAsyncHandlerWrapper extends AsyncHandlerWrapper
    implements StreamedAsyncHandler {
  private final StreamedAsyncHandler streamedDelegate;

  public StreamedAsyncHandlerWrapper(
      StreamedAsyncHandler delegate, Request request, Context context, Context parentContext) {
    super(delegate, request, context, parentContext);
    streamedDelegate = delegate;
  }

  @Override
  public State onStream(Publisher publisher) {
    try (Scope ignored = getParentContext().makeCurrent()) {
      return streamedDelegate.onStream(publisher);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy