Skip to content

Commit

Permalink
Create new header map per thrift request (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
meiliang86 authored Jun 20, 2018
1 parent 5d583df commit 5ab30b2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -370,8 +371,10 @@ private <T> ThriftRequest<T> buildThriftRequest(String apiName, T body) {
private <T> ThriftRequest<T> buildThriftRequest(String apiName, T body, Long rpcTimeoutOverride) {
String endpoint = getEndpoint(INTERFACE_NAME, apiName);
ThriftRequest.Builder<T> builder =
new ThriftRequest.Builder<T>(options.getServiceName(), endpoint);
builder.setHeaders(thriftHeaders);
new ThriftRequest.Builder<>(options.getServiceName(), endpoint);
// Create a mutable hashmap for headers, as tchannel.tracing.PrefixedHeadersCarrier assumes
// that it can call put directly to add new stuffs (e.g. traces).
builder.setHeaders(new HashMap<>(thriftHeaders));
if (rpcTimeoutOverride != null) {
builder.setTimeout(rpcTimeoutOverride);
} else {
Expand Down

0 comments on commit 5ab30b2

Please sign in to comment.