Search in sources :

Example 41 with TCompactProtocol

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);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Example 42 with TCompactProtocol

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);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) THttpClient(org.apache.thrift.transport.THttpClient) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) THttpClient(org.apache.thrift.transport.THttpClient)

Example 43 with TCompactProtocol

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;
}
Also used : AutoExpandingBufferWriteTransport(org.apache.thrift.transport.AutoExpandingBufferWriteTransport) Agent(com.uber.jaeger.agent.thrift.Agent) ArrayList(java.util.ArrayList) Process(com.uber.jaeger.thriftjava.Process) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) Span(com.uber.jaeger.Span) Batch(com.uber.jaeger.thriftjava.Batch)

Example 44 with TCompactProtocol

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;
}
Also used : AutoExpandingBufferWriteTransport(org.apache.thrift.transport.AutoExpandingBufferWriteTransport) Agent(io.jaegertracing.agent.thrift.Agent) ArrayList(java.util.ArrayList) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) Span(io.jaegertracing.thriftjava.Span) Batch(io.jaegertracing.thriftjava.Batch) TConfiguration(org.apache.thrift.TConfiguration)

Example 45 with TCompactProtocol

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());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TCompactProtocol(org.apache.thrift.protocol.TCompactProtocol) Test(org.junit.Test)

Aggregations

TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)54 TProtocol (org.apache.thrift.protocol.TProtocol)38 THttpClient (org.apache.thrift.transport.THttpClient)18 TSocket (org.apache.thrift.transport.TSocket)18 TException (org.apache.thrift.TException)15 TTransport (org.apache.thrift.transport.TTransport)11 TFramedTransport (org.apache.thrift.transport.TFramedTransport)9 IOException (java.io.IOException)8 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)7 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)7 TIOStreamTransport (org.apache.thrift.transport.TIOStreamTransport)7 TTransportException (org.apache.thrift.transport.TTransportException)5 TFramedTransport (org.apache.thrift.transport.layered.TFramedTransport)5 Test (org.junit.Test)5 LoginException (javax.security.auth.login.LoginException)4 Hello (org.tech.model.Hello)4 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 UGIAssumingTransport (org.apache.accumulo.core.rpc.UGIAssumingTransport)3 AccumuloProxy (org.apache.accumulo.proxy.thrift.AccumuloProxy)3