use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class Sw360ReleaseService method getThriftComponentClient.
private ComponentService.Iface getThriftComponentClient() throws TTransportException {
THttpClient thriftClient = new THttpClient(thriftServerUrl + "/components/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
return new ComponentService.Client(protocol);
}
use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class Sw360UserService method getThriftUserClient.
private UserService.Iface getThriftUserClient() throws TTransportException {
THttpClient thriftClient = new THttpClient(thriftServerUrl + "/users/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
return new UserService.Client(protocol);
}
use of org.apache.thrift.protocol.TCompactProtocol in project jaeger-client-java by jaegertracing.
the class UdpSenderTest method calculateBatchOverheadDifference.
private int calculateBatchOverheadDifference(int numberOfSpans) throws Exception {
AutoExpandingBufferWriteTransport memoryTransport = new AutoExpandingBufferWriteTransport(maxPacketSize, 2);
Agent.Client memoryClient = new Agent.Client(new TCompactProtocol((memoryTransport)));
Span jaegerSpan = (Span) tracer.buildSpan("raza").startManual();
com.uber.jaeger.thriftjava.Span span = JaegerThriftSpanConverter.convertSpan(jaegerSpan);
List<com.uber.jaeger.thriftjava.Span> spans = new ArrayList<>();
for (int i = 0; i < numberOfSpans; i++) {
spans.add(span);
}
memoryClient.emitBatch(new Batch(new Process(SERVICE_NAME), spans));
int emitBatchOverheadMultipleSpans = memoryTransport.getPos();
memoryTransport.reset();
for (int j = 0; j < numberOfSpans; j++) {
span.write(new TCompactProtocol(memoryTransport));
}
int writeBatchOverheadMultipleSpans = memoryTransport.getPos();
return emitBatchOverheadMultipleSpans - writeBatchOverheadMultipleSpans;
}
use of org.apache.thrift.protocol.TCompactProtocol in project jaeger-client-java by jaegertracing.
the class ThriftSenderBaseTest method calculateBatchOverheadDifference.
private int calculateBatchOverheadDifference(int numberOfSpans) throws Exception {
AutoExpandingBufferWriteTransport memoryTransport = new AutoExpandingBufferWriteTransport(new TConfiguration(), maxPacketSize, 2);
Agent.Client memoryClient = new Agent.Client(new TCompactProtocol((memoryTransport)));
Span span = new Span();
span.setOperationName("raza");
// 0, 0, 0, 0, "raza", 0, 0, 0);
List<Span> spans = new ArrayList<>();
for (int i = 0; i < numberOfSpans; i++) {
spans.add(span);
}
memoryClient.emitBatch(new Batch(new io.jaegertracing.thriftjava.Process(SERVICE_NAME), spans));
int emitBatchOverheadMultipleSpans = memoryTransport.getLength();
memoryTransport.reset();
for (int j = 0; j < numberOfSpans; j++) {
span.write(new TCompactProtocol(memoryTransport));
}
int writeBatchOverheadMultipleSpans = memoryTransport.getLength();
return emitBatchOverheadMultipleSpans - writeBatchOverheadMultipleSpans;
}
use of org.apache.thrift.protocol.TCompactProtocol in project pinpoint by naver.
the class ReplaceListCompactProtocolTest method replace.
@Test
public void replace() throws Exception {
List<ByteArrayOutput> nodes01 = new ArrayList<>();
final AtomicInteger writeTo01 = new AtomicInteger(0);
nodes01.add(new ByteArrayOutput() {
public void writeTo(OutputStream out) throws IOException {
writeTo01.incrementAndGet();
}
});
final AtomicInteger writeTo02 = new AtomicInteger(0);
List<ByteArrayOutput> nodes02 = new ArrayList<>();
nodes02.add(new ByteArrayOutput() {
public void writeTo(OutputStream out) throws IOException {
writeTo02.incrementAndGet();
}
});
ByteArrayOutputStreamTransport transport = new ByteArrayOutputStreamTransport(new ByteArrayOutputStream());
TReplaceListProtocol protocol01 = new TReplaceListProtocol(new TCompactProtocol(transport));
protocol01.addReplaceField("spanEventList", nodes01);
span.write(protocol01);
assertEquals(1, writeTo01.get());
TReplaceListProtocol protocol02 = new TReplaceListProtocol(new TCompactProtocol(transport));
protocol02.addReplaceField("spanEventList", nodes02);
span.write(protocol02);
assertEquals(1, writeTo02.get());
}
Aggregations