@Override public int hashCode() { int h = 1; h *= 1000003; h ^= this.encoding.hashCode(); h *= 1000003; h ^= this.messageMaxBytes; h *= 1000003; h ^= this.encoder.hashCode(); h *= 1000003; h ^= this.endpoint.hashCode(); h *= 1000003; h ^= this.connectTimeout; h *= 1000003; h ^= this.readTimeout; h *= 1000003; h ^= this.compressionEnabled ? 1231 : 1237; h *= 1000003; h ^= this.mediaType.hashCode(); return h; }
StreamingRequestBody(Encoding encoding, MediaType contentType, List<byte[]> values) { this.contentType = contentType; this.values = values; this.contentLength = encoding.listSizeInBytes(values); }
public static BytesMessageEncoder forEncoding(Encoding encoding) { if (encoding == null) throw new NullPointerException("encoding == null"); switch (encoding) { case JSON: return JSON; case THRIFT: return THRIFT; default: throw new UnsupportedOperationException(encoding.name()); } } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof KafkaSender) { KafkaSender that = (KafkaSender) o; return (this.encoding.equals(that.encoding())) && (this.messageMaxBytes == that.messageMaxBytes()) && (this.encoder.equals(that.encoder())) && (this.topic.equals(that.topic())) && (this.properties.equals(that.properties())); } return false; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof KafkaSender) { KafkaSender that = (KafkaSender) o; return (this.encoding.equals(that.encoding())) && (this.messageMaxBytes == that.messageMaxBytes()) && (this.encoder.equals(that.encoder())) && (this.topic.equals(that.topic())) && (this.properties.equals(that.properties())); } return false; }
@Override public int messageSizeInBytes(List<byte[]> encodedSpans) { return encoding().listSizeInBytes(encodedSpans); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof URLConnectionSender) { URLConnectionSender that = (URLConnectionSender) o; return (this.encoding.equals(that.encoding())) && (this.messageMaxBytes == that.messageMaxBytes()) && (this.encoder.equals(that.encoder())) && (this.endpoint.equals(that.endpoint())) && (this.connectTimeout == that.connectTimeout()) && (this.readTimeout == that.readTimeout()) && (this.compressionEnabled == that.compressionEnabled()) && (this.mediaType.equals(that.mediaType())); } return false; }
@Override public int hashCode() { int h = 1; h *= 1000003; h ^= this.encoding.hashCode(); h *= 1000003; h ^= this.messageMaxBytes; h *= 1000003; h ^= this.encoder.hashCode(); h *= 1000003; h ^= this.topic.hashCode(); h *= 1000003; h ^= this.properties.hashCode(); return h; }
/** Builds an async reporter that encodes zipkin v2 spans as they are reported. */ public AsyncReporter<zipkin2.Span> buildV2() { switch (sender.encoding()) { case JSON: return build(SpanEncoder.JSON_V2); default: throw new UnsupportedOperationException(sender.encoding().name()); } }
@Override public int messageSizeInBytes(List<byte[]> encodedSpans) { return encoding().listSizeInBytes(encodedSpans); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof OkHttpSender) { OkHttpSender that = (OkHttpSender) o; return (this.encoding.equals(that.encoding())) && (this.messageMaxBytes == that.messageMaxBytes()) && (this.endpoint.equals(that.endpoint())) && (this.client.equals(that.client())) && (this.maxRequests == that.maxRequests()) && (this.compressionEnabled == that.compressionEnabled()) && (this.encoder.equals(that.encoder())); } return false; }
@Override public int hashCode() { int h = 1; h *= 1000003; h ^= this.encoding.hashCode(); h *= 1000003; h ^= this.messageMaxBytes; h *= 1000003; h ^= this.encoder.hashCode(); h *= 1000003; h ^= this.topic.hashCode(); h *= 1000003; h ^= this.properties.hashCode(); return h; }
/** Builds an async reporter that encodes zipkin spans as they are reported. */ public AsyncReporter<Span> build() { switch (sender.encoding()) { case JSON: return build(Encoder.JSON); case THRIFT: return build(Encoder.THRIFT); default: throw new UnsupportedOperationException(sender.encoding().name()); } }
@Override public int messageSizeInBytes(List<byte[]> encodedSpans) { return encoding().listSizeInBytes(encodedSpans); }
@Override public int hashCode() { int h = 1; h *= 1000003; h ^= this.encoding.hashCode(); h *= 1000003; h ^= this.messageMaxBytes; h *= 1000003; h ^= this.endpoint.hashCode(); h *= 1000003; h ^= this.client.hashCode(); h *= 1000003; h ^= this.maxRequests; h *= 1000003; h ^= this.compressionEnabled ? 1231 : 1237; h *= 1000003; h ^= this.encoder.hashCode(); return h; }
public final URLConnectionSender build() { if (encoding() == Encoding.JSON) { return mediaType("application/json").encoder(BytesMessageEncoder.JSON).autoBuild(); } else if (encoding() == Encoding.THRIFT) { return mediaType("application/x-thrift").encoder(BytesMessageEncoder.THRIFT).autoBuild(); } throw new UnsupportedOperationException("Unsupported encoding: " + encoding().name()); }
@Override public int messageSizeInBytes(List<byte[]> encodedSpans) { return encoding().listSizeInBytes(encodedSpans); }
public final OkHttpSender build() { // bound the executor so that we get consistent performance ThreadPoolExecutor dispatchExecutor = new ThreadPoolExecutor(0, maxRequests(), 60, TimeUnit.SECONDS, // Using a synchronous queue means messages will send immediately until we hit max // in-flight requests. Once max requests are hit, send will block the caller, which is // the AsyncReporter flush thread. This is ok, as the AsyncReporter has a buffer of // unsent spans for this purpose. new SynchronousQueue<>(), Util.threadFactory("OkHttpSender Dispatcher", false)); Dispatcher dispatcher = new Dispatcher(dispatchExecutor); dispatcher.setMaxRequests(maxRequests()); dispatcher.setMaxRequestsPerHost(maxRequests()); clientBuilder().dispatcher(dispatcher).build(); if (encoding() == Encoding.JSON) { return encoder(RequestBodyMessageEncoder.JSON).autoBuild(); } else if (encoding() == Encoding.THRIFT) { return encoder(RequestBodyMessageEncoder.THRIFT).autoBuild(); } throw new UnsupportedOperationException("Unsupported encoding: " + encoding().name()); }